您如何在每个页面上的表标头Xtable Xtable上放置?因此,更容易读取页面之间的表。

我在Sweave中使用以下内容:

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)

感谢您的回答

有帮助吗?

解决方案

Longtable(乳胶)软件包规范 可以在该网址找到。在第8节中出现在第2和3页上的输出的示例中的代码部分,我在下面重现了其中的位:

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

当他们在“其他页面”上说时,他们的意思是除了第一页以外的每个页面,其标题不同。如果Xtable呼叫没有开箱即用而没有任何编辑,则首先应该检查您在乳胶序言中指定的长桌包:

\usepackage{longtable}

其他提示

我认为这里提供了一个更好的答案: 每个页面上的列名称Xtable in Sweave

如果您想在R中编辑桌子怎么办?上面的解决方案编辑了输出,因此您无需手动添加这些行。因此,这更好:

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

请注意,您可以在add.to.low列表中添加几个参数:

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 ")))

您必须将其添加到您的Sweave文件中:

\usepackage{colortbl}

这会在每个页面上为每个第二行和标头产生灰色填充。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top