Knit to HTML issue with R Version: 3.5.1 and RStudio 1.1.383 - Error in packageVersion("yaml")

Error Information:

Error in packageVersion("yaml") : package 'yaml' not found
Calls: ... parse_yaml_front_matter -> yaml_load_utf8 -> packageVersion
Execution halted

Description of issue
Previously, I have used RStudio with RMarkdown on both Windows 7 and Ubuntu Linux (desktop and server) with no problems. However, for teaching purposes I am now setting these tools up on Windows 10 with the new versions of R and an upgraded RStudio.

However, now I get this error message, when I knit the RStudio IDE default RMarkdown document to HTML. The same issue if I try with the RStudio IDE default notebook document.

Also, the package versions are not visible in the RStudio IDE "Packages" for the packages "evaluate" and "yaml", but for all other packages.

Steps taken so far -
"Run All" before knit to HTML gives no error and does not help.
Re-installing yaml and evaluate does not help.
Library() confirms that the yaml and evaluate packages are installed in the default user library.
The package versions are visible from the RStudio IDE "Console":

packageVersion("yaml")
[1] ‘2.2.0’
packageVersion("evaluate")
[1] ‘0.11’

Switching back to R version 3.4.3 gives a different error that can be resolved with self_contained: no in the YAML header

output:
html_document:
self_contained: no

https://support.rstudio.com/hc/en-us/community/posts/115007490773-Knit-html-error-pandoc-document-conversion-failed-with-error-67

System Information:

  • RStudio Edition: Desktop
  • RStudio Version: 1.1.383
  • OS Version: Windows 10 Pro, Version 1803, build 17134.191
  • R Version: 3.5.1 (2018-07-02)

sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_3.5.1 backports_1.1.2 magrittr_1.5 rprojroot_1.3-2 htmltools_0.3.6 tools_3.5.1 yaml_2.2.0 Rcpp_0.12.18
[9] rmarkdown_1.10 stringi_1.1.7 knitr_1.20 digest_0.6.15 stringr_1.3.1 evaluate_0.11

Hi again

I think, I resolved this issue now.

First, I uninstalled both R and RStudio and installed the new R 3.5.1 and the latest RStudio IDE 1.1.456, but I still got different error messages. Then I figured out, that the issue was related to having the default library on a synchronized network document folder. Therefore, I switched the default Library in RStudio as described here:

https://www.accelebrate.com/library/tutorials/r-rstudio-library

The RStudio IDE then showed two copies of each installed package - one copy with a package version and one copy without the package version - and I still got errors until I deleted the packages without package versions from the old default library.

So far, knit to html now works again.

best regards
Hannes