[R-SIG-Mac] install.packages: location of system-wide library tree

jochen laubrock jochen.laubrock at gmail.com
Wed May 25 12:35:10 CEST 2011


Dear expeRts,

On (my?) macs, .libPaths() contains two entries, with the first pointing to a user's library tree and the second to the system-wide library tree, as in

## begin code
v <- getRversion()
userLib <- Sys.glob(sprintf("~/Library/R/%s.%s/library", v$major, v$minor))
systemLib <- sprintf("/Library/Frameworks/R.framework/Versions/%s.%s/Resources/library", v$major, v$minor)
userLib == .libPaths()[1]
systemLib == .libPaths()[2]
# both return TRUE (on my system)
## end code

When installing new packages, I would like to make them available to all users. However, the 'lib' parameter of 'install.packages' defaults to the first element of '.libPaths()'. How do I reliably specify the location of the system library: Is it always equal to '.libPaths()[-1]'? And why is '.Library.site' empty? 

Jochen


> sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

----
Jochen Laubrock, Dept. of Psychology, University of Potsdam,
Karl-Liebknecht-Strasse 24-25, 14476 Potsdam, Germany
phone: +49-331-977-2346, fax: +49-331-977-2793



More information about the R-SIG-Mac mailing list