Xtable - how to set column width and column alignment

I am trying to create a Latex table with xtable

. Some of my column names are quite long, so I decided to fix the width of the corresponding columns. However, once I fix the column widths, I lose the column justification.

Simplified example:

counts <- c(1,2,3,4,5,6,7,8,9)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
temp <- data.frame(treatment, outcome, counts)
temp2.table <- xtable(temp)
align(temp2.table) <- "rp{1in}cc" 
colnames(temp2.table)[1] <- "This column title label is too long"

      

I would like the numbers displayed in the first column to be justified correctly.

+3


source to share





All Articles