I have the following piece of code:
tableData <- head(original_table[,c("column1",
"column2",
"column3")])
library(xtable)
xt <- xtable(tableData)
print(xt,type="html")
The 'original_table' object is a table where the columns have very awkward names which I do not want in the final output from printing the xtable.
I have a lot of code using the 'original_table' object which comes after the xtable is created. So I do not want to change the column headings in the original table.
How can I change the column headings using xtable so they can appear as something like 'Height','Width' and 'Breadth' in my table output?
xtable inherits data.frame.
So,
library(xtable)
xt <- xtable(tableData)
names(xt) <- c('Height','Width','Breadth' )
will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With