How to remove the % lines in xtable table output by Knitr

谁说胖子不能爱 提交于 2019-11-28 17:26:08

问题


By using xtable and knitr, I add a table to my RMD document and export to PDF file.

```{r, results='asis'}
library(xtable)
xtable(matrixtable)
````

It looks great except there is a line

% latex table generated in R 3.1.0 by xtable 1.7-3 package % Wed Jun 25 13:34:57 2014

How can I remove this line. I tried to set message=FALSE but it doesn't work.


回答1:


The inclusion of the comment in the final table is defined by the comment argument to print.xtable

the default value for this is getOption('xtable.comment',TRUE).

so, if you set

options(xtable.comment = FALSE)

then for any future tables this comment will not produced.




回答2:


You can put in directly in the print statement like so:

xtb=xtable(...)
print(xtb, comment=FALSE)


来源:https://stackoverflow.com/questions/24400308/how-to-remove-the-lines-in-xtable-table-output-by-knitr

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