[Rd] Request: better default R_LIBS_USER

Dirk Eddelbuettel
Thu, 16 Mar 2023 22:08:41 -0000

On 16 March 2023 at 13:39, Felipe Contreras wrote:
| I see R by default installs packages in ~/R. I know I can change the
| default directory with R_LIBS_USER, but software shouldn't be
| polluting the home directory.
|
| For example both python and node install packages to ~/.local/lib,
| ruby to ~/.local/share. They don't install to for example ~/node.
|
| R should do the same: it should install packages to somewhere inside
| ~/.local by default.

Use of ~/.local is a fairly recent convention (relative to the time R has
been around, which is now decades) and one which R supports already eg in the
(rather useful) portable config directories:

   > tools::R_user_dir("r2u")
   [1] "/home/edd/.local/share/R/r2u"
   >

Your best bet really to govern your .libPaths from your Rprofile.site and
Renviron.site rather than asking a few million R users to adjust from past
practice.

Also: personal preferences differ. I think of Linux as multi-tenant and
expect other (even system) users to have access to packages I install. So I
am happy with this default --- which goes after all back to fruitful
discussion in a bar in Vienna with Kurt and Fritz some 20 years ago:

   > .libPaths()
   [1] "/usr/local/lib/R/site-library"
"/usr/lib/R/site-library"
   [3] "/usr/lib/R/library"
   >

Dirk

--
dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org