Default library folder

I'm trying to change the default folder into which packages are installed. Currently it defaults to OneDrive. I've tried the following solutions:

  1. https://www.accelebrate.com/library/how-to-articles/r-rstudio-library
  2. https://forum.posit.co/t/default-library-for-package-installation/24890

The first link only works for a single session (even the 'permanent' change). The second seems to link to premium RStudio support.

I've also noticed that when installing packages using the RStudio GUI there is only 1 folder option in the dropdown box (OneDrive) whereas 'libPaths() shows 2 folder paths - why would these not be in agreement?

I'm really surprised that there's not a simpler way to achieve this through the RStudio GUI!

1 Like

I'm having the exact same problem. One Drive being default seems ridiculous... Why would I want libraries backed up to One Drive??

Edit: I was able to follow the second post on this SO page to set my R_LIBS_USER environmental variable to the proper folder

Once I did this I needed to change permissions on that folder so that I could write/install new libraries. Many people suggest actually creating a personal folder to store libraries in, since it's not good to change permissions on program files. Up to you.

I would highly recommend that the default library is changed, or that there is some option on install to set it (I didn't see one, and I uninstalled/reinstalled a few times trying to fix this). This feels like shoving One Drive in our face for something it's really not ideal for.

The personal library is set by default to your home directory and this is defined by your operating system, not by R or RStudio.
When you create your windows account on a computer, you are giving the option to synchronize your home directory with One Drive and is up to you to decide if you want to do it or not.

Given that we can add an install location from the RStudio console yet we can't manually select an install location from the RStudio package installation menu - I'm confused as to why there isn't simply an option within the RStudio 'Global Settings' to change where packages are installed.

This sort of question has been asked numerous times (specific OneDrive issues aside) - it would be helpful if there could be a more accessible solution.

You could file a feature request on the GitHub repository

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.