作者:Yihui Xie
译者:郑宝童
日期:2021.06.21
An R Markdown document (
*.Rmd
) is first compiled to Markdown (*.md
) through the knitr package, and then Markdown is compiled to other output formats (such as LaTeX or HTML) through Pandoc. This process is automated by the rmarkdown package. You do not need to install knitr or rmarkdown separately, because they are the required packages of bookdown and will be automatically installed when you install bookdown. However, Pandoc is not an R package, so it will not be automatically installed when you install bookdown. You can follow the installation instructions on the Pandoc homepage (http://pandoc.org) to install Pandoc, but if you use the RStudio IDE, you do not really need to install Pandoc separately, because RStudio includes a copy of Pandoc. The Pandoc version number can be obtained via:
一个 R Markdown 文档( *.Rmd
)首先通过 knitr 包编译为 Markdown( *.md
),然后通过 Pandoc 将 Markdown 编译为其他输出格式(如 LaTeX 或 HTML)。这个过程是由 rmarkdown 包自动化的。不需要单独安装knitr或rmarkdown,因为它们是bookdown的必备包,安装bookdown时会自动安装。但是,Pandoc 不是 R 包,所以安装 bookdown 时不会自动安装。您可以按照 Pandoc 主页 (http://pandoc.org) 上的安装说明安装 Pandoc,但如果您使用 RStudio IDE,则实际上不需要单独安装 Pandoc,因为 RStudio 包含 Pandoc 的副本。 Pandoc 版本号可以通过以下方式获得:
rmarkdown::pandoc_version()
## [1] '2.7.3'
If you find this version too low and there are Pandoc features only in a later version, you can install the later version of Pandoc, and rmarkdown will call the newer version instead of its built-in version.
如果你觉得这个版本太低,而且只有以后的版本才有Pandoc的特性,你可以安装更高版本的Pandoc,rmarkdown会调用新版本而不是它内置的版本。
[