By default, R packages are installed into a user-specific library based on the contents of the R_LIBS_USER
environment variable (more details on this mechanism are here: http://stat.ethz.ch/R-manual/R-devel/library/base/html/libPaths.html).
When you are working in R outside the RStudio IDE, R will use the default location described in the above link, unless R_LIBS_USER
is set explicitly in one of the startup files: .Rprofile or Rprofile.site.
However, the RStudio IDE offers more flexibility, and will look in several places for R_LIBS_USER
:
- The /etc/rstudio/rsession-profile file
- The user's bash profile
- The
r-libs-user
setting in /etc/rstudio/rsession.conf - The R startup files: .Rprofile or Rprofile.site
If R_LIBS_USER
is set in more than one place, the order of precedence is:
.Rprofile or Rprofile.site > r-libs-user
in rsession.conf > user bash profile > rsession-profile
The RStudio IDE will pick it up from any of those places, but if it’s in more than one spot, that’s the order of precedence. Additional details can be found in the Customizing Session Launches and User Library sections of the administrator's guide for RStudio Workbench (previously RStudio Server Pro).
Comments