# [R] Several problems with hmisc latex function

Erich Studerus, Psychiatrische Uni-Klinik erich.studerus at bli.uzh.ch
Sat Oct 18 13:46:58 CEST 2008

Hi,

I'm having several problems with the Hmisc latex function. First, there
seems to be a conflict between the cellTexCmds and the cgroupTexComds. When
I'm using both at the same time, I get an error message. Here's an example.
I just added cellTexComds to the example on page 10 of this document:
http://biostat.mc.vanderbilt.edu/twiki/pub/Main/StatReport/latexFineControl.pdf

x <- matrix(1:30, ncol = 5)
y <- letters[1:6]
x <- data.frame(x, y)
cell.format <- matrix(rep("", NCOL(x) * NROW(x)), ncol = NCOL(x))
cell.format[1,1]<-"bfseries"

latex(x, file = "", cgroup = c("Group A", "Group B", "Group C"), n.cgroup =
c(2, 2, 2), rgroup = c("First", "Second"), n.rgroup = c(4, + 2),
colnamesTexCmd = "color{green}", cgroupTexCmd = "scshape", rgroupTexCmd =
"bfseries", numeric.dollar = FALSE, title = "", ctable = TRUE, label =
"tab:severalCgroups", caption = "More than two column
groups.",cellTexCmds=cell.format)

I also would like to add more space between the column names and the line
above them. With the defaults the column names are extremly close to the
line. Adding "\\vspace{5mm} works, but adds the space below the names and
not on top of the names, where I want to put it.

I'm also struggling with the dcolumn option. Can anyone give a reproducible
example for this option. I tried

x<-matrix(c(34.567,3.45,4.5789,345.5),2,2)
x<-format.df(x,dcolumn=TRUE)
latex(x,ctable=T)

but it does not work.