Column names on each page with xtable in Sweave

半城伤御伤魂 提交于 2019-12-04 09:31:04

问题


I want to have column names on each page of the xtable.

\documentclass{article}
\usepackage{graphicx}   
\usepackage{longtable}

\begin{document}

<<>>=
x <- matrix(rnorm(1000), ncol = 10)
x.big <- xtable(x,label='tabbig',caption='Example of longtable spanning several pages')
@

<<label = tabSEM.S, echo = FALSE, results = tex >>=
print(x.big,tabular.environment='longtable',floating=FALSE)
@

\end{document}

Any help will be highly appreciated. Thanks


回答1:


I think this is really a LaTeX question, which I simply Googled and ended up with a simple answer from tex.stackexchange.com here.

Try this (untested in LaTeX; will be curious if this compiles the way you want):

print(x.big,tabular.environment='longtable',
        floating=FALSE,
        hline.after = c(-1,nrow(x.big)),
        add.to.row = list(pos = list(0),command = "\\hline \\endhead "))


来源:https://stackoverflow.com/questions/8691241/column-names-on-each-page-with-xtable-in-sweave

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!