Specifying project-specific version of pandoc possible?

In my daily work I use pandoc 2.7.2 and everything knits fine.

Recently someone suggested at a local R Users' meeting to checkout the DataExplorer package. After installing the package, a quick example fails to knit unless I change .Renviron to point to an older 2.6 version of pandoc.

RSTUDIO_PANDOC = "C:\pandoc26"      

For others using the current pandoc, does this short DataExplorer example work for anyone?


I see this error with Pandoc 2.7.2 that goes away when I use Pandoc 2.6:

File d3.min.js not found in resource path
Quitting from lines 26-28 (samples.Rmd) 
Error: pandoc document conversion failed with error 99

Editing .Renviron to make changes by RStudio project is not a good solution. How can I specify the version of pandoc I want knitr to use in my project instead of .Renviorn?

1 Like

What specifically don't you like about the .Renviron solution?

If you want to be able to specify a specific pandoc executable to use that varies by project, you could add a project-specific .Rprofile to each project. For example, putting the .Rprofile below into a project's root directory causes rmarkdown to use the pandoc in /usr/bin/ instead of the one bundled with RStudio:

Sys.setenv(RSTUDIO_PANDOC = "/usr/bin/pandoc")
if (file.exists('~/.Rprofile')) source('~/.Rprofile')

The main downside of course is this makes your code harder to run on different computers that may have different file paths. If you need more flexible control of the pandoc version, you could use a tool designed for managing software versions like conda or even Docker.

Also, I confirmed your observation that create_report(iris) works for pandoc 2.6 but failed for pandoc 2.7 (more specifically I used pandoc 2.7.3 on Ubuntu 18.04).

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.