Tao Shi <shitao <at> hotmail.com> writes: > ## 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)
The example you posted is good, but it is more helpful to post the code, not the pasted result, so that trying you example does not require manual editing. I had reported a similar case a year ago; see below. Maybe you should post it at: http://biostat.mc.vanderbilt.edu/trac/Hmisc/ # library(Hmisc) sessionInfo() x <- matrix(1:12, nrow=2, dimnames=list(c('a','p'), letters[1:6])) cellTex = matrix(rep("", NROW(x) * NCOL(x)), nrow=NROW(x)) cellTex[1,1] <- "cellcolor[gray]{0.9}" # works ok p = latex(x,file="a.tex", cellTexCmds = cellTex) # ok # Works ok p = latex(x,file="a.tex", cgroup = c("a","b","c"),n.cgroup=c(2,2,2) ) # Fails with a error message "subscript out of bounds" p = latex(x, file="a.tex", cellTexCmds = cellTex, cgroup = c("a","b","c"),n.cgroup=c(2,2,2) ) ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.