[R] Hmisc latex cell background color

Dieter Menne dieter.menne at menne-biomed.de
Sun Dec 18 13:15:18 CET 2005

David Whiting <david.whiting <at> ncl.ac.uk> writes:

> The nearest I got to was to be able to colour row. Take a look at Table
> 10 here:

After some private emailing with David and downloading the latest version of 
the docs, I found the new command \cellcolor in colortbl, which makes coloring 
of single cells painless.



x <- as.data.frame(diag(rnorm(3),nrow=3))
cellTex <- matrix(rep("", NROW(x) * NCOL(x)), nrow=NROW(x))
cellTex[2,2] <- "\cellcolor{red}"
ct <- latex(x, cellTexCmds = cellTex,numeric.dollar=FALSE)
ct$style <- "colortbl" # this forces load of colortbl (not documented?)

More information about the R-help mailing list