Search code examples
renvironment

Changing libpath in R does not take effect


Am trying to change the .libpaths() in R

Currently I see the below two paths

.libPaths()

[1] "C:/Program Files/R/R-4.0.5/library"
[2] "C:/Users/test/AppData/Local/Temp/Rtmpkj8NNm/renv-system-library"

However, I would like to retain only the 1st libpath

So, I tried the below

myPaths <- c("C://Program Files//R//R-4.0.5//library")

.libPaths(myPaths)

.libPaths()

But still I see both the paths as output

.libPaths()
[1] "C:/Program Files/R/R-4.0.5/library"                                
[2] "C:/Users/ephssmk/AppData/Local/Temp/Rtmpkj8NNm/renv-system-library"

Can help me retain only the 1st path as .libpaths()?

If temp folder should definitely be there in .libpaths, why is it storing under renv-system-library?


Solution

  • What you're seeing is the renv sandbox library. It's discussed a bit in the FAQ, as well as in ?renv::config, but it probably deserves some more documentation elsewhere.

    https://rstudio.github.io/renv/articles/faq.html

    That said, I'm a little confused. It looks like you're trying to use renv with a project, but you want to change the library paths so that the renv library path isn't actually used? You can probably use renv::deactivate() to disable renv in that project, then re-launch R.