Message-ID: <561008.23736.qm@web56602.mail.re3.yahoo.com>
Date: 2009-01-08T20:30:16Z
From: Felipe Carrillo
Subject: help
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
\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