r语言 - rmarkDown编号一个块中的多个数字/表



我的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')

最新更新