# [R] help

Felipe Carrillo mazatlanmexico at yahoo.com
Thu Jan 8 21:30:16 CET 2009

Hi:
I am going through some of the xtable examples and I can't make the one below work. I need to create a longtable on the fly keeping the column headers for all the pages and I thought this example could give some ideas on how to do it. I am using Sweave and xtable to create my tables and graphics. I wonder if someone could tell me what's wrong. Thanks

## 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
\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$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')
@
\end{longtable}
\end{small}
## End(Not run)

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