Using only a common lib folder for all users in Ubuntu
In R, you cat get the environment variables:
> Sys.getenv("R_HOME")
[1] "/usr/lib/R"
> Sys.getenv("R_ENVIRON")
[1] ""
> Sys.getenv("R_PROFILE")
[1] ""
> Sys.getenv("R_PROFILE_USER")
[1] ""
The library folder are defined here:
> Sys.getenv("R_LIBS_USER")
[1] "/home/agirard/R/x86_64-pc-linux-gnu-library/4.2"
> Sys.getenv("R_LIBS_SITE")
[1] "/usr/local/lib/R/site-library/:/usr/lib/R/site-library:/usr/lib/R/library"
This is what you get with:
.libPaths()
In
> system(paste0("ls -al ", file.path(Sys.getenv("R_HOME"), "etc")))
total 16
drwxr-xr-x 2 root root 4096 juil. 27 20:20 .
drwxrwxrwx 8 mgirond mgirond 4096 juil. 28 13:25 ..
-rw-r--r-- 1 root root 234 juin 26 22:22 javaconf
lrwxrwxrwx 1 root root 14 juin 26 22:22 ldpaths -> /etc/R/ldpaths
lrwxrwxrwx 1 root root 15 juin 26 22:22 Makeconf -> /etc/R/Makeconf
lrwxrwxrwx 1 root root 15 juin 26 22:22 Renviron -> /etc/R/Renviron
lrwxrwxrwx 1 root root 20 juin 26 22:22 Renviron.site -> /etc/R/Renviron.site
-rw-r--r-- 1 root root 1923 juin 26 22:22 Renviron.ucf
lrwxrwxrwx 1 root root 19 juin 26 22:22 repositories -> /etc/R/repositories
lrwxrwxrwx 1 root root 20 juin 26 22:22 Rprofile.site -> /etc/R/Rprofile.site
Renviron.site is a copy of /etc/R/Renviron.site
Add R_LIBS_USER="" în /etc/R/Renviron.site
and
chmod 777 /usr/local/lib/R/site-library
Then restart R or Rstudio server
$ rstudio-server restart
Commentaires
Enregistrer un commentaire