Rstudio knit pdf in Rstudio loadNamespace (name): no package called 'rmarkdown'

I just updated the version of Rstudio version 0.98.1074. When I try to use a compiled laptop with a script or knit pdf with .rmd, I get

Error in loadNamespace error: no package called 'rmarkdown'

so far I can type rmarkdown::render("filename.rmd") and it will display the document. I uninstalled rmarkdown and reinstalled using RStudio , and that didn't help. I have updated all my packages and I am using R3.1.1.

This is a slight inconvenience, as I have a workaround, but I thought I would post it in case there is a solution that I cannot find.

+5
source share
1 answer

I got almost the same error when trying to use Rmarkdown on Windows in Cygwin:

 loadNamespace(name): there is no package called 'rmarkdown' 

Everything worked fine in Rstudio, but didn't work when I tried to automate some .Rmd files in Cygwin.

My library path in Rstudio:

 .libPaths() [1] "C:/Users/Gravitas/Documents/R/win-library/3.3" "C:/Program Files/R/R-3.3.2/library" 

My library path specified by Cygwin when running C:\Program Files\R\R-3.3.2\bin\R.exe :

 .libPaths() [1] "C:/Program Files/R/R-3.3.2/library" 

Problem:

  • When Rstudio starts in a mode other than the administrator, it cannot write anything to C:/Program Files/R/R-3.3.2/library , since this directory is write-protected.
  • Thus, Rstudio writes new packages to the user profile directory, which is freely writable.
  • However, Cygwin did not know about the user profile directory, so he could not find all the new packages.

The solution was to set this environment variable in Cygwin:

 export R_LIB=C:/Users/Gravitas/Documents/R/win-library/3.3 

Now the path reported by Cygwin is as follows:

 .libPaths() [1] "C:/Users/Gravitas/Documents/R/win-library/3.3" "C:/Program Files/R/R-3.3.2/library" 

And now I can call bash scripts in Cygwin to automatically knit .Rmd files .

0
source

Source: https://habr.com/ru/post/1205112/


All Articles