[R] "latex" in Hmisc: cell formating

Tao Shi shitao at hotmail.com
Fri Jan 23 00:21:40 CET 2009


Hi list,

Could you explain the error I see here?  Thanks!

## I'm using R 2.8.0 on WinXP, Hmisc_3.4-3

> table1 <- matrix(10, 180,7)
> cell.format <- matrix("", ncol=7, nrow=180)
> cell.format[c(seq(3,180,6),seq(4,180,6)),] <- "color{red}"
> cell.format[c(seq(5,180,6),seq(6,180,6)),] <- "color{green}"
> 
> latex(table1, where='htbp', long=TRUE,  lines.page=1000,  size="scriptsize",
+     cgroup=c("group1","group2"), n.cgroup=c(6,1),
+     rgroup=c("n=1","n=5","n=10","n=20","n=50"), n.rgroup=rep(36,5),
+       cellTexCmds=cell.format, numeric.dollar = FALSE)
Error in cat(rcellTexCmds[i, colNum], " ", cx[i, colNum], file = file,  : 
  subscript out of bounds
> 
> 
## if I remove the column name grouping, it works fine!
##
> latex(table1, where='htbp', long=TRUE,  lines.page=1000,  size="scriptsize",
+     #cgroup=c("group1","group2"), n.cgroup=c(6,1),
+     rgroup=c("n=1","n=5","n=10","n=20","n=50"), n.rgroup=rep(36,5),
+       cellTexCmds=cell.format, numeric.dollar = FALSE)

Thanks!

...Tao




More information about the R-help mailing list