0

I have my R packages spread over multiple directories, both user-specific and system-wide:

r$> .libPaths()                                            
[1] "/home/user/R/custom_lib"                     
[2] "/home/user/R/x86_64-pc-linux-gnu-library/4.2"
[3] "/usr/local/lib/R/site-library"                       
[4] "/usr/lib/R/site-library"                             
[5] "/usr/lib/R/library"

I'd like to move all packages to the system directory /usr/lib/R/library, and I was wondering if I can just move the folders, or will that create problems? Alternatively, how would I go about it?

Pål Bjartan
  • 793
  • 1
  • 6
  • 18
  • 2
    I'm not adding an answer right now because this isn't really an answer to the question but - why exactly do you want to do this and are you the only person using that device? – Dason Jul 12 '22 at 14:55
  • 1
    As a small off-the-cuff response though - I don't think moving the folders corresponding to the other installed packages into one of the other library folders would negatively impact R in any way. It might make some packages "installed" for other users on the system but that's probably one of the only issues you might have within R itself. The main issue is just package management - the system itself has a package manager and you're writing stuff into what is essentially the system's territory. Is there a problem with this? Not really but it could get messy later on. I just don't recommend. – Dason Jul 12 '22 at 15:02
  • 1
    https://stackoverflow.com/q/7133394/7758804, https://stackoverflow.com/q/31707941/7758804, [r move packages from user to system library site:stackoverflow.com](https://www.google.com/search?q=r+move+packages+from+user+to+system+library+site:stackoverflow.com&rlz=1C1RXQR_enUS982US982&sxsrf=ALiCzsa11libFA0yzf-ZUZMte_dBRZahdw:1657652446685&sa=X&ved=2ahUKEwiRpPvJhPT4AhXoITQIHcCOCXQQrQIoBHoECC0QBQ&biw=2560&bih=1335&dpr=1) – Trenton McKinney Jul 12 '22 at 19:01
  • @ Dason The reason for moving all libraries to the same folder is because having some system-wide and some user-specific tend to create issues when updating. If I run `update.packages()` in R as user, I am unable to update system directories. If I run R as super user, I am unable to update user libraries. This issue is further amplified by some packages installed in user directory have dependencies installed system wide and vice-a-versa. This results in having to run `update.packages()` multiple times as my regular user and as super user, and some has to be reinstalled. – Pål Bjartan Jul 12 '22 at 19:56

0 Answers0