R:用xtable()打印两个表
我有数据表(d1 和 d2),我想在乳胶中并排打印或彼此叠加打印,并带有各自的标题。是否可以直接使用 xtable() 来做到这一点?这两个表应该是不同的,即我们可以将它们称为表x(a)和表x(b),但它们应该相邻或堆叠。
I have data tables (d1 and d2) which I would like to print side by side or on top of each other in latex with their own individual titles. Is it possible to do that directly with xtable()
? The two tables should be distinct, i.e. we could call them Table x(a) and Table x(b), but they should be either adjacent, or stacked.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议将结果保存为不同文件中的两个单独的表(请参阅
print.xtable()
的file=
选项),然后input
使用您认为适合您的布局的任何命令(tabular
、subfloat
、minipage
等)将它们放入您的 LaTeX 文档中。这就是我通常所做的,尽管我通常依赖 中的 LaTeX 工具Hmisc 包。如果您只想将它们打印为独立的 PDF,请为您的文档使用standalone
类。所以,这是一个例子:
然后,一个快速的 tex 包装器(使用
pdflatex
编译):结果如下:
删除默认(堆叠)布局的
\scalebox
命令,除非它们足够窄以适应默认大小,如 @David 所指出的。I would recommend saving the results as two separate tables in different files (see the
file=
option toprint.xtable()
), and theninput
them into your LaTeX document with any command you find appropriate for your layout (tabular
,subfloat
,minipage
, etc.). This is what I do in general, although I generally rely on LaTeX facilities in the Hmisc package. Should you want only to print them as a standalone PDF, use thestandalone
class for your document.So, here is an example:
then, a quick tex wrapper (compile with
pdflatex
):Here is the result:
Remove the
\scalebox
command for default (stacked) layout, unless they are narrow enough to fit at their default size, as noted by @David.请参阅 Alan Munn 在 tex.stackexchange.com 上对类似问题的回答。
See Alan Munn's answer to a similar question on tex.stackexchange.com.