[R] longtable example

Felipe Carrillo mazatlanmexico at yahoo.com
Thu Jan 8 18:12:00 CET 2009


Hi:
Could someone try to run this example? I can't make it work.
## Not run: 
 \begin{small}
 \setlongtables
 \begin{longtable}{
 <<results=tex,fig=FALSE>>=
 cat(paste(c('c', rep('cc', 34/2-1), 'c'), collapse='@{\hspace{2pt}}'))
 @ 
 }
 \hline
 \endhead
 \hline
 \endfoot
 <<results=tex,fig=FALSE>>=
 library(xtable)
 set.seed(2345)
 res <- matrix(sample(0:9, size=34*90, replace=TRUE), ncol=34, nrow=90)
 xres <- xtable(res)
 digits(xres) <- rep(0, 35)
 addtorow <- list()
 addtorow$pos <- list()
 addtorow$pos[[1]] <- c(seq(4, 40, 5), seq(49, 85, 5))
 addtorow$pos[[2]] <- 45
 addtorow$command <- c('\vspace{2mm} \n', '\newpage \n')
 print(xres, add.to.row=addtorow, include.rownames=FALSE, include.colnames=FALSE, only.contents=TRUE, hline.after=NULL)
 @
 \end{longtable}
 \end{small}
## End(Not run)


Felipe D. Carrillo  
Supervisory Fishery Biologist  
Department of the Interior  
US Fish & Wildlife Service  
California, USA




More information about the R-help mailing list