Using renv in my project. But why deleting package from binary cache will brake R script execution?

56 Views Asked by At

I am confused with all renv thing. From my understanding there are should be just 2 environments:

global or system (C:\Program Files\R\R-4.3.2\library)

and user:

(C:\Users\myusername\Documents\R\myproject\renv\library\R-4.3\x86_64-w64-mingw32)

So if I want isolate my project packages I need to install them into renv of my project (C:\Users\myusername\Documents\R\DUAL Automations\renv\library\R-4.3\x86_64-w64-mingw32)

Running .libPaths() gives me the below output:

.libPaths()
[1] "C:/Users/myusername/Documents/R/myproject/renv/library/R-4.3/x86_64-w64-mingw32"
[2] "C:/Users/myusername/AppData/Local/R/cache/R/renv/sandbox/R-4.3/x86_64-w64-mingw32/1e360f03"

I understand the [1] is my project renv.

But what about [2]? Who set this path? Why do I have packages in it?

I also discovered another locations with packages in it, and the most important, if I delete a package from this location my R script won't execute!

C:\Users\myusername\AppData\Local\R\cache\R\renv\binary\R-4.3\x86_64-w64-mingw32\repository

So my questions are:

  1. why .libPaths() gives me this location [2] "C:/Users/myusername/AppData/Local/R/cache/R/renv/sandbox/R-4.3/x86_64-w64-mingw32/1e360f03"? Can I change it or remove it?

  2. why deleting package from C:\Users\myusername\AppData\Local\R\cache\R\renv\binary\R-4.3\x86_64-w64-mingw32\repository will brake my R script even though I have renv with same package in it? Does it mean I am not using renv?

Thanks

0

There are 0 best solutions below