1.1 Use a Pandoc version not bundled with the RStudio IDE
The RStudio IDE has bundled a version of Pandoc, so you do not need to install Pandoc by yourself if you are using the RStudio IDE. However, the bundled version is often not the latest, or may not be the exact version that you want. You can choose to install a separate copy of Pandoc by yourself. Please keep in mind that the bundled version may be more thoroughly tested with R Markdown, because most RStudio users may just use the bundled version. If you want to go with a different version (especially a higher version), you might run into problems that have not been discovered by other R Markdown users or developers.
There are detailed instructions on how to install Pandoc on different platforms on the Pandoc website at https://pandoc.org/installing.html. If you have installed Pandoc by yourself and want to use that specific version, you may inform the rmarkdown package by calling the function
As you can see in the above code chunk, there are several ways to find a version of Pandoc. By default,
rmarkdown::find_pandoc() tries to find the highest version of Pandoc in your system. Once found, the version information is cached, and you can invalidate the cache with
cache = FALSE. Please see the help page
?rmarkdown::find_pandoc for the potential directories under which the
pandoc executable may be found.
This function can be called either inside or outside an Rmd document. If you want an Rmd document to be compiled by a specific version of Pandoc installed on your computer, you may call this function in any code chunk in the document, e.g., in a setup chunk: