system.file(package = "rmarkdown")

[1] "\\coe.ic.gov/Home/ESDC/nga_home_052/al52975/My Document/R/win-library/3.6/rmarkdown"

Thanks for this. So the full path without the letter H: is what R sees.

When you paste this in an explorer windows do they both work

  • Two backslashes : \\coe.ic.gov/Home/ESDC/nga_home_052/al52975/My Document/R/win-library/3.6/rmarkdown
  • One backslashes:\coe.ic.gov/Home/ESDC/nga_home_052/al52975/My Document/R/win-library/3.6/rmarkdown

I wonder if these two backslashes are the issue here. Pandoc had an issue with these

Fixed in Pandoc 2.11 it seems: Command line options: use normalizePath in more places. · jgm/pandoc@26ed7fb · GitHub

We'll know for sure if there is still an issue in Pandoc if you can upgrade and test it

I have a fix. I 'm running an older version of RStudio version 1.0.143 and everything is working. I found a zipped file, unzipped it, and ran the *.exe. Every thing is working so this would appear to be an issue with my version (1.2.5033 and the windows 10 configuration I have to live with ???). So at this point I guess I wait until my IT folks upgrade both R and RStudio (and RTools).
-- Jeff

This could mean that using a different Pandoc version fix your issue. Which is the version of Pandoc with this ?

You can rule out Pandoc once you'll test both version with same version of Pandoc. If so, then it could be a RStudio bug.

You can also rule out RStudio 1.2, by running the rmarkdown::render() outside of RStudio (or in a background session using callr - this would require setting the path to PANDOC correctly so that it is found when you are outside of RStudio)

rmarkdown::pandoc_version()

[1] '1.17.2'

How would I test both versions with same version of Pandoc, given Pandoc is loaded with the RStudio files?

Wow this is a really old one! You'll loose some features of rmarkdown with such an old version.
Pandoc 2.0 brought a lot of new stuff we have built on.

So your issue maybe fixed because you downgraded Pandoc. The command line you should see should be fairly different than the previous one I think. If you want to share maybe this could help.

It is here above :Understanding R Markdown Output Code - #12 by cderv

Ok so I tried running RStudio (version 1.0.143) with Pandoc 2.7.2. Same issue came up. So might that suggest the Pandoc file is corrupted????

I'm also reading the reference you listed - 1.1 Use a Pandoc version not bundled with the RStudio IDE | R Markdown Cookbook

That means what you see is something related to Pandoc. There are big differences betwen 1.17.2 and 2.7.2, and even last 2.11.4. rmarkdown is following version so it could also come from a behavior between rmarkdown and Pandoc.

About Pandoc, as I said above in Understanding R Markdown Output Code - #22 by cderv Pandoc has fixed some of this issues in the past and last I know of were fixed in Pandoc 2.11.

So if you could try the last Pandoc version to see if there is still an issue, that would really help.
Once again following 1.1 Use a Pandoc version not bundled with the RStudio IDE | R Markdown Cookbook should allow you to download a pandoc binary and set R Markdown to use this one.

Also, did you have some result from the small test above ? Understanding R Markdown Output Code - #15 by cderv
Is this not working at all ? Is there some convert command that works ?

That would help try narrow down this issue.

I just tried adding these lines to my R Notebook

rmarkdown::render("H:/My Document/Temp/Test2.Rmd",
                                output_file = "H:/My Document/Temp/Test2.html",
                                output_format = "html_document"
                                 )

same results, pandoc error

Been reviewing these discussions

Those discussion are mainly what I am talking about above.

I am still unsure from you answer what is working from the test

dir.create(tmp_dir <- tempfile())
owd <- setwd(tmp_dir)

xfun::write_utf8(c(
  "---", 
  "title: test",
  "---", 
  "",
  "# dummy",
  ""
), "test.md")

convert <- function(template) {
  rmarkdown::pandoc_convert(
    "test.md",
    to = "html",
    from = "markdown",
    output = "test.html",
    verbose = TRUE,
    options = c("--template", template)
  )
}
# with path computed from R not modified by rmarkdown - should fail ?
convert(system.file("rmd/h/default.html", package = "rmarkdown"))
# with path computed from R but modified by rmarkdown - should work ?
convert(rmarkdown::pandoc_path_arg(system.file("rmd/h/default.html", package = "rmarkdown")))
# manual path - short path with ~
convert("\\coe.ic.gov\\Home\\ESDC\\NGA_HO~2\\al52975\\My Documents\\R\\win-library\\3.6\\rmarkdown\\rmd\\h\\default.html")
convert("//coe.ic.gov/Home/ESDC/NGA_HO~2/al52975/My Documents/R/win-library/3.6/rmarkdown/rmd/h/default.html")
# manual path - long path without ~
convert("\\coe.ic.gov\\Home\\ESDC\\nga_home_052\\al52975\\My Documents\\R\\win-library\\3.6\\rmarkdown\\rmd\\h\\default.html")
convert("//coe.ic.gov/Home/ESDC/nga_home_052/al52975/My Documents/R/win-library/3.6/rmarkdown/rmd/h/default.html")
# manual path - using letter
convert("H:\\My Documents\\R\\win-library\\3.6\\rmarkdown\\rmd\\h\\default.html")
convert("H:/My Documents/R/win-library/3.6/rmarkdown/rmd/h/default.html")

# reseting work dir an cleaning
setwd(owd)
unlink(tmp_dir, recursive = TRUE)

Also, you need to test with last Pandoc so that we understand if Pandoc has fix this or not as it could be the case from Windows UNC Paths Broken · Issue #5127 · jgm/pandoc · GitHub

Basically, this is where I am at:

  • It could be a pandoc issue related to Network path. If so, using last Pandoc to convert without using render() but Pandoc directly or using example code above could confirm or not if this is still the case
  • It could be rmarkdown which modifies the file paths in a wrong way on Windows. The above test should tell us.

We are going to try a complete re-install of my hard-drive

Oh ok. Sorry it leads to that.

But did you run the different tests command I sent ?

No I didn't run the different test commands you sent. I convinced our IT folks to re-image my hard-drive. In the meantime I am running R Studio 1.2.xxx and R 4.0.5 from my local "Data Drive - D:) and it works just fine. So I'll see what happens once they finish re-imaging my hard-drive.

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.