Installing R Libraries

Due to the nature of how R libraries are distributed, from an administration stand point, this makes it very difficult to install centrally. To get around this, the following will show how to install R libraries within one's home directory.

First, create a directory within your home directory to store the libraries, such as /home/username/Rlibs. Then create a file named .Renviron within your home directory (i.e. /home/username/.Renviron) and add the following to that file: R_LIBS="/home/username/Rlibs". Any libraries installed will be placed there.

R has two ways to install packages, either downloaded directly via R from their repository or the user downloads the source file and R builds it. For most packages, the online method should work. For example, start R: > install.packages('packageName'). Some packages may not work with this method and report that it is unavailable. In that case, go to CRAN and download the source directly and have R build it. For example: $ R CMD INSTALL package.tar.gz.

If a package has dependencies, install those packages first. Contact the staff for assistance if you run into any issues with dependencies outside of R that are required for building a particular package.