Archive for the ‘Data Science’ Category
Fixing OneDrive annoyance with Rstudio on Windows
By default, Rstudio on Windows with OneDrive installed stores packages in the OneDrive documents folder. This package location causes a lot of issues:
- It causes a lot of upload to OneDrive
- It can cause conflicts between machines (since they will be storing to the same OneDrive folder)
- It can cause unnecessary delays in having to download files from OneDrive (if they are not locally cached)
All in all, this location seems to be a poor side-effect of making OneDrive the default storage location on Windows. It can be easily rectified. Simply create a file called .Renvironment in “C:\Users\<username>\OneDrive\Documents” (AKA your OneDrive documents folder) with the following line:
R_USER="C:/User/<username>"
This one line redefines the user-specific directory to be on the local disk, in C:\Users\<username>. This is the exact same place as the %USERPROFILE% environment variable on Windows. The site-wide .Rprofile will make use of this variable and create an package path using it as a base.
These mechanisms are explained here, and it is simpler than editing the site-wide .Rprofile as described here (and many other places), which would require you to repeat the procedure on new installations (and also requires modifying files in the base installation path).