If you need to install R packages on an individual basis please follow the instructions below while logged on to a College of Public Health Linux workstation. This will help you install any R library you wish to try out without needing to contact the IT office any time you’d like to test a library that CRAN has made available within R.
Our objective is to create a directory within your Home folder and then use a variable to point R to the directory in your home so the package can be installed.
At the shell prompt, enter the following command:
export R_LIBS="~/r_libraries"
then from within R you can do:
install.packages('package_name', repos="http://cran.r-project.org")
and you’re done.
So you don’t have to type it every time, put the export command in your .bashrc file:
export R_LIBS="~/r_libraries"
If you encounter any difficulties with your R libraries, please contact the College of Public Health IT Office.