Reputation: 433
Is there any documentation on manually installing a package in a user library when the R.home()
path is locked down and incomplete (no etc
, no bin
, just library
?) The system does NOT support shelling out to execute R CMD
, which I believe standard R does.
I would like to build existing source packages (from CRAN) and install into a user library directory, so that I can use the library()
function and get all the usual namespace and *.Rdx and *.Rdb files.
At the moment, I'm plodding through install.packages
, tools::.build_package
, and tools:::.install.packages
source, using a standard MacOS R and the r source. Hopefully this has been documented in a more user-friendly fashion and my google searches have missed it.
Thanks.
Upvotes: 1
Views: 648
Reputation: 76700
You don't need to use a different install.packages
method, rather you only need to specify a writable location for storing packages and give it precedence over the system default one. A simple way to accomplish this is to set an R_LIBS
environment variable. For instance, in my .bashrc
I have
export R_LIBS='/home/username/.local/lib/R-3.3.3'
Then, by default, all packages are installed here. Further, packages installed both here and the system-wide location will give priority to the ones here when loading.
You can verify that the location is being used by checking .libPaths()
in your R session.
Upvotes: 1