Skip to content
Back to formatted view

Raw Message

Message-ID: <5B9313E1-E348-4444-A996-A8BB60421FF8@gmail.com>
Date: 2011-05-25T10:35:10Z
From: Jochen Laubrock
Subject: install.packages: location of system-wide library tree

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