繁体   English   中英

RMarkdown 在一个块中对多个数字/表格进行编号

[英]RMarkdown numbering multiple figures/tables in one chunk

我的 RMarkdown 文档有代码块,可以从一个块中生成多个图形或表格。 例如,它遍历一堆变量以生成每个变量的汇总统计表。 问题是当我尝试生成 HTML 文档时,这些图形/表格的编号经常是错误的; 编译PDF时不会发生此问题。 问题是从同一个块生成的所有表都将获得相同的表号。

下面是一个例子:

---
title: "Testing Section Numbers"
author: "Authors"
date: "January 2019"
output:
  bookdown::gitbook:
    number_sections: yes
editor_options:
  chunk_output_type: console
---

# R Markdown

Text text text 

```{r pressure1, echo=FALSE, fig.cap=c("This is my plot", "This is my other plot")}
plot(pressure)

plot(iris)
```

```{r pressure2, echo=FALSE}
library(knitr)
kable(pressure, caption = "My first table")
kable(pressure, caption = "My second table")
```

这是由于knitr 的一个错误, 我刚刚在 Github 上的开发版本中修复了这个错误。 请尝试

remotes::install_github('yihui/knitr')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM