[R] Hmisc latex: table column width

Lauri Nikkinen lauri.nikkinen at iki.fi
Fri Jul 4 13:59:57 CEST 2008


R users,

I'm trying to set a column width to one of the columns in a latex
table (using Hsmic package, latex function). My intention is to get

\begin{tabular}{lp{1.2in}llllll}\hline\hline

Here's an example

####### R code #########
DF <- data.frame(Titanic)
DF$long <- paste("This is a veeeeeeeeeeryyyyyyyyyy long line")
DF <- DF[, names(DF)[c(6,1:5)]]

library(Hmisc)
DF.latex <- format.df(DF, na.blank=TRUE, math.row.names=TRUE,
math.col.names=TRUE)
#and when I try...
attr(DF.latex, "col.just")[1] <- "lp{1.2in}"
#..it does not help
latex(DF.latex,
       title="",
       caption="Titanic",
       file="",
       rowname="",
       caption.loc="top",
       where="ht")

#I get
#\begin{tabular}{lllllll}\hline\hline
######## end ###########

How should I modify my code to get column width parameter into the latex table?

Thanks
Lauri



More information about the R-help mailing list