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, this howto 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(ie /home/username/.Renviron) and add the following to that file:

R_LIBS="/home/username/Rlibs"

Now 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')

Now some packages may not work with this method and report that its unavailable. In this 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, you'll want to install those packages first. If you run into any issues with dependencies outside of R that are required for building a particular package, contact the staff for assistance.