I'm unable to render a markdown file when my RMD file is on a shared drive. I'm using rmarkdown version 1.12, R version 3.5.3, 64-bit Windows 10, pandoc 2.7.1.
I can not render to html, pdf or a word doc.
This fails (there are no spaces or punctuation in my folder path):
rmarkdown::render("//cor.local/subfolders/Martin/aNewRMD.RMD")
But this succeeds:
rmarkdown::render("C:/Users/Martin/Documents/aNewRMD.RMD")
(I'm just using the default new .RMD file that RStudio opens up).
Error message:
processing file: aNewRMD.RMD
|......... | 14%
ordinary text without R code
|................... | 29%
label: setup (with options)
List of 1
$ include: logi FALSE
|............................ | 43%
ordinary text without R code
|..................................... | 57%
label: cars
|.............................................. | 71%
ordinary text without R code
|........................................................ | 86%
label: pressure (with options)
List of 1
$ echo: logi FALSE
|.................................................................| 100%
ordinary text without R code
output file: aNewRMD.knit.md
"C:/Pandoc/pandoc" +RTS -K512m -RTS aNewRMD.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output aNewRMD.html --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\Martin\Documents\R\win-library\3.5\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header "C:\Users\Martin\AppData\Local\Temp\RtmpGoqMWG\rmarkdown-str421411883120.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
pandoc.exe: aNewRMD.utf8.md: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1
I believe that R does not know (yet) how to speak arbitrary URIs for network shares. Though I'm guessing that some functions (and other packages) might support other schemes, the download.file help page says
The function 'download.file' can be used to download a single file
as described by 'url' from the internet and store it in
'destfile'. The 'url' must start with a scheme such as 'http://',
'https://', 'ftp://' or 'file://'.
What you are doing with "//cor.local/subfolders/Martin/aNewRMD.RMD" is telling it to speak a windows file sharing protocol (smb, cifs, etc) to a host named cor.local (somehow authenticating) and navigate to the respective sub-directory.
My suggestion: make windows deal with the basic authentication ahead of time, and "mount" it so that every app on your local computer will see it as "local" but mounting it to a drive letter:
C:\Users\AM4337> net use /user:yourdomain\youruser g: \\cor.local\subfolders
(it should ask for your password), and then working with/on it locally with
R> rmarkdown::render("G:/Martin/aNewRMD.RMD")
I was having the same problem with multiple users trying to run an existing R process after an organisational upgrade to windows 10: 'Error: pandoc document conversion failed with error 1'.
Changing the project folder to an RStudio project solved the issue. An RStudio project sets its own working directory using the local path for each user, so replaces the network path with a local, lettered, path. Thanks @r2evans for explaining the issue and enabling this workaround.
(Apologies for the separate answer, I do not have the reputation to comment on @r2evans answer.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With