To install R packages without root access:

Create a file .Renviron in our home folder with the line


You may have to create the folder under your home directory:
mkdir ~/Rpackages

Whenever you start R, the directory ~/Rpackages/ is added to the list of places to look for R packages and we can simply install new ones through the R command line:

> install.packages("ggplot2")
> library(ggplot2)

should install it in the custom directory. You can use the “work” location to share these with your group (substituting your group name),


If you use different versions of R for different purposes, you can add to the library folder a %V which R will substitute with the version number.

Adapted from

Relevant R documentation