RMarkdown Knit to HTML, Word & PDF

Encountering errors attempting to knit your RMarkdown documents on CCSS servers? Check out the answers below to solve.

Knit HTML & Word

Error message received when I attempt to knit RMarkdown file to HTML or Word.
pandoc.exe: \\: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1
Execution halted

Example 1


#GREEN TEXT IS A COMMENT. CREATED FOR YOUR REFERENCE
#SOLUTION: Copy and paste the normal colored font commands included below. Make sure to check that output from your commands resemble mine.
#Check out library paths. I want to C: drive path to be listed first.
library(rmarkdown)
.libPaths()
#[1] "\\\\rschfs1x/userRS/F-J/jrg363_rs/Documents/R/win-library/3.6"
#[2] "C:/Program Files/R/R-3.6.1/library"
#Switch order of paths using commands below.
myPaths <- .libPaths() # get the paths
myPaths <- c(myPaths[2], myPaths[1]) # switch them
.libPaths(myPaths) # reassign them
#View result of .libpaths(), results should be switched.
.libPaths()

#[1] “C:/Program Files/R/R-3.6.1/library”
#[2] “\\\\rschfs1x/userRS/F-J/jrg363_rs/Documents/R/win-library/3.6”

Example 2


#Check out library paths. I want to C: drive path to be listed first.
.libPaths()
#[1] "\\\\rschfs1x/userts/jrg363_ts/Documents/.checkpoint/2019-12-14/lib/x86_64-w64-mingw32/4.0.1"
#[2] "\\\\rschfs1x/userts/jrg363_ts/Documents/.checkpoint/R-4.0.1"
#[3] "C:/PROGRA~1/R/R-40~1.1/library"

mypaths <- .libPaths()
#Take 3rd and 2nd paths in that order. ignore 1st.
mypaths1 <- c(mypaths[3], mypaths[2])
#Set Lib paths
.libPaths(mypaths1)
.libPaths()

Now knit file to HTML or Word should work. If not please email with questions.
Information gotten from following URL
Rstudio libraries

Knit PDF

Error message received when I attempt to knit to pdf.
Sorry, but C:\PROGRA~1\MIKTEX~1.9\miktex\bin\x64\pdflatex.exe did not succeed.
! The log file hopefully contains the information to get MiKTeX going again:
! C:\Users\jrg363_rs\AppData\Local\MiKTeX\2.9\miktex\log\pdflatex.log
Error: LaTeX failed to compile program.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See program.log for more info.
Execution halted

#This process of setting up PDF took me an hour to load. You must do this process every time you open a new Rmarkdown session and would like to knit to pdf. Suggested idea to setup your RMarkdown to knit to pdf, then disconnect your session. Thus signing in to that same server will have you all set up. View URL below for how to disconnect.
#Manage CCSS Sessions

#SOLUTION: Copy and paste the normal colored font commands included below.
install.packages('tinytex')
#Users can not write to C: drive. If pop-up windows asks question included in screenshot below answer 'YES'
R using personal library?
#Command below takes the most time. Approx an hour to run to completion. Once this command is complete running user is allowed to knit to pdf.
tinytex::install_tinytex()
#While the above command runs expect to see the following windows pop-up. Errors suggest noting, they can be ignored. Answer 'OK' for all these windows.
expected 2 error messages, ignore them
error message pop-up to be ignored
#Output of command used above too long to paste.
#Use command below to test if above command worked. Expect result to be TRUE

tinytex:::is_tinytex()
#[1] TRUE


You should be able to knit to pdf now.
Any issues or questions please send email to
Information received from following URL
knit to pdf

Lastly, re-installing packages like ‘knitr’, ‘rmarkdown’ and ‘xfun’ may resolve the issue.