Captions on tables in pdf documents generated by rmarkdown

女生的网名这么多〃 提交于 2019-11-30 14:05:47

Or similarly,

```{r results='asis'}
knitr::kable(head(mtcars), format = 'pandoc', caption = 'Title of the table')
```

The 'caption' is a parameter to xtable, not to print.xtable

```{r, results='asis'}
print(xtable(table, caption='Captions goes within xtable'), comment = FALSE)
```

If you are using markdown anyway, why not stick to the same (simple and nice) format. Quick example:

> library(pander)
> pander(table(mtcars$am), caption = 'foo')

-------
 0   1 
--- ---
19  13 
-------

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