The title on each page of a large xxtable table?

How do you put a large table xxtable table header on each page ?, so it is easier to read a table table between pages.

In Sweave, I use the following:

test.big<- xtable(test,label="table",caption='test') align(test.big) <- "|c|c|c|c|l|c|c|c|" print(test.big,tabular.environment='longtable',include.colnames = TRUE,floating=FALSE) 

thank you for your responses

+4
r bigtable sweave latex xtable
source share
2 answers

the longtable package specification (LaTeX) can be found at this URL. The code section in the examples, the output of which appears on pages 2 and 3, is given in section 8, and I reproduced its bit below:

 \caption[]{(continued)}\\ \hline\hline \multicolumn{2}{@{*}c@{*}}% {This part appears at the top of every other page}\\ \textbf{First}&\textbf{Second}\\ \hline\hline \endhead 

When they say β€œon every other page”, they mean every page different from the first one that had a different heading. If the xtable call does not work from the window without any editing, you should first check that you have the longtable package specified in the LaTeX preamble:

 \usepackage{longtable} 
+4
source share

I think the best answer to this question is below: Column names on each page using xxtable in Sweave

What if you want to edit the table in R? The solution above edits the output, so you will not need to add these lines to your long code manually. So this works better:

 print(test.big, tabular.environment='longtable', include.colnames = TRUE, floating=FALSE, add.to.row = list(pos = list(0), command = "\\hline \\endhead ")) 

Note that you can add multiple arguments to the add.to.row list:

 print(test.big, tabular.environment='longtable', include.colnames = TRUE, floating=FALSE, list(pos = list(seq(1,nrow(get(groups[i])), by = 2), 0), command = c("\\rowcolor[gray]{.95} ","\\hline \\endhead "))) 

You need to add this to your Sweave file:

 \usepackage{colortbl} 

This creates a gray fill for every second line and title for each page.

+8
source share

All Articles