1. Use a personal library. Mucking with the default library puts you at risk of changing file permissions on your personal files inadvertently and making them unusable by your normal user. Even if you did alter your user permissions so you could mess with it without elevating privileges, POSIX is designed as a multi-user system and the other users will generally not like having shared packages changed without their knowledge.
2. The default library is where R goes looking if you don't have the desired package in your personal package. It is normally updated only when the R software is updated. On April 7, 2021 12:40:04 PM PDT, Gene Leynes <gley...@gmail.com> wrote: >Hello R Community, > >I've been using R for a long time, and this is a question that still >makes >me think twice every single time I install R, which is more and more >often . > >The first search hit is this StackOverflow question: >https://stackoverflow.com/questions/32540919/library-is-not-writable > >The warning message hasn't changed over the years: > >install.packages("randomForest") >Installing package into ‘/usr/local/lib/R/site-library’ >(as ‘lib’ is unspecified) >Warning in install.packages : > 'lib = "/usr/local/lib/R/site-library"' is not writable > >In this question they suggest using the personal library, which is what >I >end up doing as well, but some people suggest changing your group. >This >actually seems like the right answer to me, but others say they had >problems when they changed groups, which also sounds about right. > >Can someone please tell me (or tell StackOverflow) the real best >practice? > >I've gotten into some very thorny issues with installations that can't >find >any library when I deploy jobs using cron or other users, and it's hard >to >remember / figure out how to install (if missing) libraries in the >script >because it's hard to remember the mirror syntax. > >I know there's a packrat package, and I've invented some workarounds, >but >I normally just need two or three stable packages for a particular >project. >I'd bet that .libPaths would be implemented differently today, but >maybe >with the right library path none of that would be necessary to >understand? > >My final simplified questions are: > > 1. What is the best practice to install libraries so that the current > user (Linux) can always find them? > 2. Why is the default library path not writable by default, should we > change that? > >Hope everyone's doing well out there, and I hope to see some of you at >conferences when things get back to normal. > >Thank you, > >Gene > > [[alternative HTML version deleted]] > >______________________________________________ >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code. -- Sent from my phone. Please excuse my brevity. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.