Split xtable ouput into sub tables

给你一囗甜甜゛ 提交于 2019-11-30 18:49:16

Here's an example of this from ?latex.table.by in the taRifx package. You can brew something similar using longtable in LaTeX and use the latex.table.by code as a prototype.

my.test.df <- data.frame(grp=rep(c("A","B"),10),data=runif(20))
library(xtable)
latex.table.by(my.test.df)
#   print(latex.table.by(test.df), include.rownames = FALSE, include.colnames = TRUE, sanitize.text.function = force)
#   then add \usepackage{multirow} to the preamble of your LaTeX document
#   for longtable support, add ,tabular.environment='longtable' to the print command (plus add in ,floating=FALSE), then \usepackage{longtable} to the LaTeX preamble

Regardless, the longtable package in LaTeX is the key.

Edit: It appears you have too many columns not too many rows. In that case, first try landscaping just that page.

In the header:

\usepackage{lscape}

Around your table:

\begin{landscape}
...
\end{landscape}

Or just use sidewaystable.

If your table is too wide to fit in one page, try the supertabular package, which from the description sounds like it might handle breaking over multiple pages based on width (but I've never used it so can't be sure).

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