I am getting sporadic errors from pandoc while trying to knit Rmarkdown files in RStudio. Some files (but not all) consistently return
"Access violation in generated code ...
Error: pandoc documentation failed with error 11."
In addition to the version of pandoc that is installed along with RStudio, my Windows system also contains a separate installation of Pandoc 2.4 that I use as part of my workflow for a bunch of things outside of R and RStudio. So I really can't (don't want to) uninstall it.
When running at the console inside RStudio, I also see the following:
> Sys.getenv('RSTUDIO_PANDOC')
[1] "C:/Program Files/RStudio/bin/pandoc"
However, the error message that comes while knitting starts the command line with
"C:/PROGRA~1/Pandoc/pandoc" +RTS -K512m -RTS ...
This command uses the separate 2.4 version of pandoc, even though the (automatic) environment variable points RStudio to its own copy. How do I make RStudio use its own copy so I can at least confirm that the problem is in the pandioc version?
Note: This problem is also harder to debug because the "keep_md: true" setting in the YAML header is being ignored, so I can't test pandoc outside of RStudio on the markdown file.