[英]knitr, R Markdown, and xtable: xtable tables within HTML table
Suppose I want to print HTML tables using xtable, side-by-side. 假设我想使用xtable并排打印HTML表。 I tried doing this in an .Rmd file with:
我尝试在.Rmd文件中执行此操作:
<table border = 1>
<tr>
<td>
`r functionThatPrintsAnHTMLTableUsingxtable`
</td>
<td>
`r functionThatPrintsAnotherHTMLTableUsingxtable`
</td>
</tr>
</table>
No dice. 没有骰子。 What am I doing wrong?
我究竟做错了什么? Thanks.
谢谢。
I think your code will work if you put results=asis
in the chunk options. 我认为如果将
results=asis
放在块选项中,您的代码将会起作用。
<table border = 1>
<tr>
<td>
```{r results='asis', echo=FALSE}
library(xtable)
data(tli)
print(xtable(tli[1:20, ]),type='html')
```
</td>
<td>
```{r results='asis', echo=FALSE}
library(xtable)
data(tli)
print(xtable(tli[1:20, ]),type='html',comment=FALSE)
```
</td>
</tr>
</table>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.