2

Windows seems to put R libraries in a onedrive directory by default if onedrive is in use. This is undesirable especially if you're using both R and onedrive on multiple computers with the same onedrive account.

How would I set my library to be put inside of C:\users<username>\documents instead of in C:\users<username>\onedrive\documents? There are good solutions here (How do I change the default library path for R packages), but they're mostly focused on solving this for a single windows account. Is there a general way to solve it for all accounts?

Michael
  • 5,808
  • 4
  • 30
  • 39

2 Answers2

2

Every R installation has an etc/ directory with configuration, in it you can set Rprofile.site or, easier still, Renviron.site.

Files ending in .site should not get overwritten on the next install. Make sure you don't bulk delete though.

You can query where it is via R.home("etc"). On my (Linux) system:

> R.home("etc")
[1] "/usr/lib/R/etc"
> 
Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
0

Really excellent solution from here (https://github.com/r-windows/docs/issues/3):

just create an Renviron.site file in the /etc folder of your Rinstallation, then copy the following line to it:

R_USER=C:/Users/${USERNAME}/Documents

This sets R_USER which in turn sets R_LIBS_USER according to the user directory of each account under windows 10.

Michael
  • 5,808
  • 4
  • 30
  • 39