v UNLV National Supercomputing Institute

How to Install Local R packages on Cherry Creek

Overview

This document is based on one developed at the Ohio Supercomputing Center

https://www.osc.edu/documentation/howto/install-local-R-packages

First Step
(you need to do this only one time)

It is a good idea to create an area to store your installed packages in your
home directory or bulk storage area, for example, ~/R_libs.

you need to create the directory and create a R environment variable:

mkdir ~/R_libs
echo 'export R_LIBS=~/R_libs/' >> ~/.Renviron

How to install a local package
(you can do this as many times as you need)

Once you set your R_libs directory, you can then install packages like so:

module load R
R install.packages("lattice", repos="http://cran.r-project.org")

You may get a warning asking if you want to use a personal library,
you should answer: yes

Warning in install.packages("lattice", repos = "http://cran.r-project.org") :
'lib = "/share/apps/R-3.2.2/lib64/R/library"' is not writable
Would you like to use a personal library instead? (y/n) y
Would you like to create a personal library
~/R/x86_64-pc-linux-gnu-library/3.2
to install packages into? (y/n) y