Creating a personal library for R packages.

When you install R, the default action is to create a directory for any new packages in the same system directory where the R program is installed. This implies that when you want to install a new pacakge, you need administrative access to this directory. For many people (especially with a corporate or government issued computer), the general user is NOT granted administrative access to keep the user from (accidently) installing a malicious piece of software. Unfortunately, this also implies that the user cannot install new packages, nor can the user update the packages.

Additionally, everytime you upgrade to a new version of R, the default behavious is to NOT copy the old collection of libraries from the older version to the newer version. Consequently, you need to reinstall all of the packages that you collected in the old version. This can be inconvenient.

Because of these potential problems, it is recommended that you create a personal package library where any new package that you install will be placed. This personal library can easily be upgraded with a single command whenever a new version of R is installed using the update.packages() function, or the drop down menus in R and Rstudio.

Refer to FAQ 4.2 of R for more details.

Here are instruction for Windoze and Macintosh machines. If you have a Unix machine that is not a Macintosh, the instructions will be similar to that from the Macintosh.

Many corporate and goernment environments "lockdown" computers so users cannot install packages following the step above.
Here are instruction on how to install packages when you do not have administrative access to your Windoze machine.

[ SFU Statistics and Actuarial Science Home | SFU Home]
Email comments or suggestions to Carl Schwarz (
© 2013 Carl James Schwarz Last updated 2013-10-18.