我无法理解如何在R-Markdown中的表格中添加图形标题编号表。我正在使用bookdown
并一直试图了解文档中的2.5 tables部分。
它说当你为kable
函数添加一个标题时,它会自动标记为编号。但是,我只获得标签的“文本”部分而没有数字。
---
title: "test"
author: "x"
date: "February 20, 2019"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
```{r libraries, echo=FALSE}
library(tidyverse, warn.conflicts = T)
library(kableExtra)
library(bookdown)
```
```{r example, echo=T}
head(pressure) %>%
kable(caption = "Pressure",
booktabs = T) %>%
kable_styling(full_width = F)
```
非常感谢您帮助理解如何做到这一点。
由于bookdown
标题,你没有使用rmarkdown::html_document()
但output
。您需要将标题更改为
---
title: "test"
author: "x"
date: "February 20, 2019"
output: bookdown::html_document2
---
为了在单个文件项目中使用bookdown
功能。对于实际书籍,最好让bookdown
包装为您设置骨架,例如:通过RStudio加载项。