gpt4 book ai didi

在 RMarkdown 中引用一个简单的表格

转载 作者:行者123 更新时间:2023-12-01 17:46:39 27 4
gpt4 key购买 nike

我在 RMarkdown 中有一个我想要引用的表格

  Right     Left     Center     Default
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1

Table: Demonstration of simple table syntax.

谁能告诉我如何引用它。所以基本上我想说请查看表 1.1 了解更多详细信息

最佳答案

不依赖于输出格式的解决方案是 pandoc-crossref filter 。每当您输出表格时,请添加对其标题的引用(此处使用 pander):

```{r}
library(pander)
tb <- table(sample(letters[1:4], 10, replace=TRUE))
pander(tb, caption= "my table {#tbl:mytable}")
```

然后您可以通过以下方式引用此表:

see [@tbl:mytable] for more details

要运行过滤器,请将其添加到您的 YAML 标题中:

---
output:
pdf_document:
pandoc_args: ["-F=pandoc-crossref"]
---

Pandoc-crossref 可以通过其 binaries 进行安装或通过haskell platform 。在后一种情况下:

cabal update
cabal install pandoc-crossref

关于在 RMarkdown 中引用一个简单的表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41084793/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com