Windows 7/10: If your C:\Program Files (or wherever R is installed) is blocked for writing, as mine is, then you’ll get frustrated editing RProfile.site (as I did). As specified in the accepted answer, I updated R_LIBS_USER and it worked. However, even after reading the fine manual several times and extensive searching, it took me several hours to do this. In the spirit of saving someone else time…
Let’s assume you want your packages to reside in C:\R\Library:
- Create the folder
C:\R\Library. Next I need to add this folder to theR_LIBS_USERpath: - Click
Start–>Control Panel–>User Accounts–>Change my environmental variables - The
Environmental Variableswindow pops up. If you seeR_LIBS_USER, highlight it and clickEdit. Otherwise clickNew. Both actions open a window with fields forVariableandValue. - In my case,
R_LIBS_USERwas already there, andValuewas a path to my desktop. I added to the path the folder that I created, separated by semicolon.C:\R\Library;C:\Users\Eric.Krantz\Desktop\R stuff\Packages.
(NOTE: In the last step, I could have removed the path to the Desktop location and simply left C:\R\Library).