On Thu, Jul 06, 2017 at 02:02:52PM +0200, Sergio Oller wrote:
Hi,
As comments are welcome I will give my two cents and a patch suggestion
2017-07-06 10:42 GMT+02:00 Dirk Eddelbuettel <edd at debian.org>:
I have used such settings (such as un-setting R_LIBS_USER or its
predecessors) for over a decade, it just works (if you give write
permissions). It clearly helps us at work because everybody sees by
the default the same packages. I have also spoken with different R
Core members and several find the default installation below $HOME and
in a versioned directory less than ideal as well. But it ensures
writeability. Which I cannot do easily from the package.
So maybe the change was too abrupt, and I think I may revert it. I
generally prefer for packagers like myself to not divert from upstream
unless they have good reasom or are unintrusive (and eg the added
tab-completion we have here is both). But leaving newbies without
installable directories is bad, as is possibly hiding existing
installations.
There are several entangled issues:
1. What should be the default places where packages are installed?
2. What should be the default places where packages are loaded from?
That's both the same -- what .libPaths() shows, and which can be set
in several ways.
3. Ensuring that with the default R installation any user can install
packages
Yes, and that went wrong this time.
For 1., I believe packages should be installed at:
- /usr/lib/R/library, if they are given by a .deb package (core R
- /usr/lib/R/site-library/, if they are given by a .deb package (other
packages)
- /usr/local/lib/R/site-library/, if the user has permissions
- ~/R/x86_64-pc-linux-gnu-library/3.4, (or somewhere else under $HOME,
otherwise)
The first three (in reverse order) have been our default for 15 or years.
The fourth is what R adds (even if a few people have reservations) and
it provides a fallback.
For 2., I believe packages should be loaded from:
- ~/R/x86_64-pc-linux-gnu-library/3.4
- /usr/local/lib/R/site-library/
- /usr/lib/R/site-library/
- /usr/lib/R/library
I believe with 3.4.1-1 Dirk tried to move towards that configuration, and
for some reasons we ended in a situation where the R library in the HOME
directory was not considered to write into and was not considered to load
packages from.
This is how R works:
- When we use `library("package_name")`, the package_name is searched in
the directories given by .libPaths().
- When we use `install.packages("package_name")`, by default the
installed in the first element of .libPaths().