Installing into C:/Program Files/R/...
makes a package available to all users of the computer.
It is the R default, but installing a package there from within R (using install.packages()
requires that R is started with administrator privileges.
Installing into C:/Users/Username/...
makes the package available to the present user only, but does not require administrative rights.
R tracks these paths automatically, and looks in both directories when it is asked to load a package with require()
or library()
. No user input should be required.
When you update R, the version number will of course change, meaning that R will no longer look in the folders whose paths contained the previous version number. Some R updaters (e.g. installR) offer to copy packages from the "old" paths to the "new" paths, though an manually re-installing packages means that you can be sure that you are using the latest version of each package, and that you don't waste disk space and update time on packages that you are no longer using.