longtable example
This is what I got.
\documentclass[11pt]{article}
\usepackage{longtable,lscape}
\usepackage{accents}
\usepackage[usenames,dvipsnames]{color} % load all the colors
\title{\color{Blue}How to transfer column names and add captions to pages in document}
\begin{document}
\maketitle
I am using Sweave and MikTex to generate my report but I am having problems with a table
that has 52 rows. I have no problem creating the 'longtable' but since my table is created dynamically,
I don't know how to transfer the column names to the second page of the PDF. I can name my column
names manually but since the table is created on the fly I wonder if there's a way that the column
headers from the first page be transferred automatically to the second or third pages and also have
captions on the header and footer of the pages ( something like 'Continued on next page').
Here's an example
<<tab.R,echo=FALSE,results=tex>>=
x <- matrix(rnorm(1000), ncol = 10)
x.big <- data.frame(x)
x.big <- xtable(x,label='big',align="c|cccccccccc|",caption='Example of longtable spanning several pages')
print(x.big,tabular.environment='longtable',latex.environments=c("center"),include.rownames=FALSE,floating=FALSE)
@
I want to add the column headers from the first page to the rest of the pages
and the caption 'Continued' to the top of each page. Thanks
\end{document}
--- On Thu, 1/8/09, Dieter Menne <dieter.menne at menne-biomed.de> wrote:
From: Dieter Menne <dieter.menne at menne-biomed.de> Subject: Re: [R] longtable example To: r-help at stat.math.ethz.ch Date: Thursday, January 8, 2009, 11:32 PM Felipe Carrillo <mazatlanmexico <at> yahoo.com> writes:
Could someone try to run this example? I can't
make it work. It would be better if you would show a complete sample; the error could be in the header part, and chances are better to get a reply when other do not have to guess what to add.
\begin{small}
\setlongtables
\begin{longtable}{
<<results=tex,fig=FALSE>>=
cat(paste(c('c', rep('cc', 34/2-1),
'c'), collapse='@{\hspace{2pt}}'))
@ } \hline
The { after \begin{longtable} looks suspicious.
Dieter
______________________________________________ R-help at 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.