Request a space for user maintained software for the R libraries.
If there is no existing ~/.Renviron, create it in the home directory and define where the R libraries will be. For an existing file ~/.Renviron that lists a custom-named default local library, define the new /usrapps directory first in a colon separated list. Additional libraries may have been installed in a home directory using the default R-named directory for local libraries, and that location does not have to be explicitly defined.
Create a text file ~/.Renviron containing the location of the libraries, e.g.: R_LIBS=/usr/local/usrapps/[group]/[unityid]/libs/R
Do not use the library path /usr/local/usrapps/[group] directly because the group may want to install something other than R packages at some point. Create the directory before doing the installs; R_LIBS has to be an existing directory.
If you already have a custom directory in ~/.Renviron, add it after a colon, e.g.:
R_LIBS=/usr/local/usrapps/[group]/[unityid]/libs/R:/my/custom/Rlibs
To check whether R has defined the library paths as expected, open R and type:
.libPaths()
Here is an example for user lllowe:
The /home/lllowe/.Renviron file contains:> .libPaths() [1] "/gpfs_common/share01/Support/lllowe/libs/R" [2] "/home/lllowe/Rlibs" [3] "/home/lllowe/R/x86_64-pc-linux-gnu-library/3.5" [4] "/usr/local/apps/R/gcc_4.8.5/R-3.5.1/lib64/R/library"
Install or load R libraries as usual. For installs, new libraries will be installed in the first directory listed in the output of .libPaths(). For loading libraries, R will look for the library in order from first to last in directories defined in the output of .libPaths().