Change Local Library for R-Packages

You might have been wondering, that after having installed or updated your system to a new R version, the package installation Path within your RStudio still refers to your “old” location. In some situations, this might make sense. However, after changing to a completeley new version (main release number) of R, you might want to create a new library location for the R packages to be installed to.

Install Packages Dialog in RStudio

The location where R-Packages are installed to is configured with the envionment variable R_LIBS.

Within Windows type ‘environ…’ in the Start-Search to open the Systemproperties overview, where ‘Environment Variables’ can be selected (“Umgebungsvariablen…” in German Windows versions). Within System-Variables you can find the R_LIBS Property, which is pointing to the location R/RStudio is using to install the Packages to.

After having changed the location to your desired path, apply changes, close and restart RStudio and the then the new location will be used.