[Rd] Request: better default R_LIBS_USER

Henrik Bengtsson henr|k@bengt@@on @end|ng |rom gm@||@com
Fri Mar 17 01:15:09 CET 2023


> Your best bet really to govern your .libPaths from your Rprofile.site and
Renviron.site ...

To do this for any version of R, one can add:

R_LIBS_USER=~/.local/share/R/%p-library/%v

to ~/.Renviron or the Renviron.site file. This automatically expands
to the platform and R x.y version early on when R starts up, e.g.
~/.local/share/R/x86_64-pc-linux-gnu-library/4.2.

> rather than asking a few million R users to adjust from past practice.

We're all starting out with a fresh R_LIBS_USER once a year when a new
minor version of R is released, so changing the default should be
doable without major troubles. On MS Windows, this move has already
been made. When R 4.2.0 was released, the default R_LIBS_USER location
on MS Windows was changed, similarly, to the Local Application Data
directory in R (>= 4.2.0), e.g.
C:\Users\alice\AppData\Local\R\win-library\4.2.

/Henrik

On Thu, Mar 16, 2023 at 3:09 PM Dirk Eddelbuettel <edd using debian.org> wrote:
>
>
> 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 using debian.org
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list