Ric*_*ard 7 r xtable knitr r-markdown
如何在rmarkdown生成的pdf_document中获取我的表浮动的标题?
运用
output:
pdf_document:
fig_caption: true
Run Code Online (Sandbox Code Playgroud)
和
```{r, fig.cap='a caption'}
myplot
```
Run Code Online (Sandbox Code Playgroud)
使用myplot和指定的标题生成浮动数字.
如何使用xtable生成的表实现相同的功能?
```{r, results='asis', fig.cap='table caption'}
print(xtable(table), comment = FALSE)
```
Run Code Online (Sandbox Code Playgroud)
我曾尝试在print.xtable中使用floating.environment ='figure',但无济于事.
Yih*_*Xie 12
或者类似地,
```{r results='asis'}
knitr::kable(head(mtcars), format = 'pandoc', caption = 'Title of the table')
```
Run Code Online (Sandbox Code Playgroud)
“标题”是 xtable 的参数,而不是 print.xtable 的参数
```{r, results='asis'}
print(xtable(table, caption='Captions goes within xtable'), comment = FALSE)
```
Run Code Online (Sandbox Code Playgroud)