user797963 user797963 - 9 months ago 73
R Question

How can I use multiple library paths?

I'm trying to set up an easy to use R development environment for multiple users. R is installed along with a set of other dev tools on an NFS mount.

I want to create a core set of R packages that also live on NFS so n users don't need to install their own copies of the same packages n times. Then, I was hoping users can install one off packages to a local R library. Has anyone worked with an R setup like this before? From the doc, it looks doable by adding both the core package and personal package file paths to


Answer Source

You want to use the .Renviron file (see ?Startup).

There are three places to put the file:

  • Site wide in R_HOME/etc/
  • Local in either the current working directory or the home area

In this file you can specify R_LIBS and the R_LIBS_SITE environment variables.

For your particular problem, you probably want to add the NFS drive location to R_LIBS_SITE in the R_HOME/etc/ file.

## To get R_HOME