On Thu, Mar 16, 2023 at 4:08?PM Dirk Eddelbuettel <edd at 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
I already have fixed it for myself, my request was about the default,
so most users don't have to fix it for themselves too.
> rather than asking a few million R users to adjust from past
> practice.
Why would they have to adjust anything?
Just expand %U to both:
paste(c(
file.path(home, ".local", "lib", "r",
x.y),
file.path(home, "R", paste0(R.version$platform,
"-library"), x.y)
), collapse = ":")
Then R would install packages to the new location in new installations
by default, but still use packages from the old location if present.
Moreover, this location is going to change the next time the minor
version is bumped anyway.
Cheers.
--
Felipe Contreras