Reputation: 10954
I am trying to follow advice here & here, to update the location where R looks for installed packages. I have updated the variable .Library.site
in the /etc/R/Rprofile.site
file to include the location of the intended R package library directory:
Sys.setenv(".Library.site" = "~/AppData/R/x86_64-pc-linux-gnu-library/")
However, when I start up R, and do a .libPaths()
the location is not appended to the list of library locations. Why?
Upvotes: 4
Views: 1022
Reputation: 368231
Three answers:
Your approach is wrong. .libPath()
is an R function, not an environment variable. What you do above above cannot work.
Per a consensus with (some members of) R Core, I have been setting the path to three location since circa 2003 for Debian / Ubuntu. That is done below /etc/R/
and you probably saw it.
The easiest to set a per-user directory would be via R_LIBS_USER
which I typically comment-out as I like as users on a machine to have consistent paths. You can set it either in the global Renviron
, or in the global Renviron.site
(better) or in ~/.Renviron
(probably best).
You do that via R_LIBS_USER="~/AppData/R/x86_64-pc-linux-gnu-library/"
.
Upvotes: 5