|
I get questions: How do I install R packages on computers when I
can't write to the system library?
It is very easy to do. Here are the steps:
- Start R.
- Run this R command:
dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE)
This will create a personal \Users\$user\My Documents\R\win-library\x.y
for version x.y of R. It only needs to be run once, to make sure
that the directory structure exists.
-
You can install packages at this point in the usual way.
-
You will need to restart R to see the packages you installed in the previous step in the Load Packages dialog.
-
You will need to update the personal library if the version
changes. R's FAQ suggests:
For those with a personal library (folder R\win-library\x.y of your
home directory, R\win64-library\x.y on 64-bit builds), you will
need to update that too when the minor version of R changes
(e.g. from 2.14.2 to 2.15.0). A simple way to do so is to copy
(say) R\win-library\2.14 to R\win-library\2.15 before running
update.packages(checkBuilt=TRUE, ask=FALSE).
|
|
|