我经常交换使用knitr::kable
and DT::datatable
在我的报告中显示表格,具体取决于数据有多少行。我需要这些表格是数字,以便可以在文档中引用它们
问题是以下代码不会生成第一个表格的表格标题和参考,我必须使用奇怪的解决方法,这些解决方法不能可靠地工作或完全切换到手动对表格进行编号。
---
title: "Example"
format: html
---
As you can see in @tbl-iris, this example does not work. However, it does
work for `knitr::kable`, as you can see in @tbl-iris2.
```{r}
#| label: tbl-iris
#| tbl-cap: Example DT table
DT::datatable(head(iris))
```
```{r}
#| label: tbl-iris2
#| tbl-cap: Example kable table
knitr::kable(head(iris))
```
这是的输出quarto render test.qmd
:
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)