New 'R' Folder at Start up

Hello,

I've just started using Rstudio with my university studies so please forgive me for this super weird question, or if it has been asked somewhere else!

After I installed Rstudio and opened it for the first time it created a folder called 'R' in my Documents. The R folder contains a few subfolders with nothing in them at this stage, but I'm assuming the program will try and autosave here potentially or place libraries here, idk I'm super new..
Anyway, I don't want to get rid of this folder, however it's clogging my google drive and I wanted to move it into my 'university programs' folder which is a couple of layers deeper in my documents. That way it'll be THERE but it isn't where it is now.

My problem is that whenever I move the folder and then open Rstudio again it makes the same 'R' folder in my Documents and doesn't work from the one I just moved to my uni programs folder where I want it to stay. Is it possible to set a directory so it knows where to find this version the 'R folder' and it doesn't constantly make new copies?

To be clear I'm not talking about the actual program file. But the one that goes Documents > R > win-library > 4.0 > ....

Thanks for your help!

Hi,

Welcome to the RStudio community!

Packages are by default installed per user. This is so that if R is shared between several users, they each can have their own package libraries. If you are the only user on a PC, and R is installed locally, you can change this default folder. Just follow this excellent guide:
https://www.accelebrate.com/library/how-to-articles/r-rstudio-library

Note that they say you have to run RStudio as an administrator in order for you to change the library to the R install folder. You do this (in Windows) by right clicking the RStudio icon and choosing: "Run as Administrator".

The guide also explains how to setup other paths, but I think if you just want it to be out of the way, you can just select the R installation folder.

Hope this helps,
PJ

Hey! Thanks so much for your help,

So I went through this guide word for word, and everything went perfectly, until the end!
I'm the only user and have full administrator rights over the pc but when I tried to enter my code to the end of the startup code, it tried to tell me that I didn't have permission to make the changes, is this on the Rstudio side or am I somehow not opening the file as an admin, giving me the right to make changes/save?

Hi,

You have to open everything that you edit again with admin rights. So if you need to edit a document with word-pad for example, you first have to open wordpad as admin (right click method).

If editing a file in RStudio prevents saving it, open it in word-pad or notepad++ or something as admin and edit / save then.

PJ

  • Opened wordpad as admin
  • Tried to navigate to the Rprofile.file
  • wasn't able to see the file to open it

  • Closed everything and went to Rprofile.file in file explorer
  • tried to open it as an admin, no option to open it as an admin

  • opened preferences and gave myself full rights over the file
  • entered the code and save was successful !!!

  • if i go to tools > install packages, it now shows the correct destination every time restart the program
  • I went and deleted the initial, problematic R folder so there was no trace of it or my Rhistory.file that accompanied it

  • opened Rstudio
  • the R folder popped up again, nothing changed. It didn't start saving to the new location we set using the guide
  • so unfortunately back to the start

  • if it helps at all this is the folder I'm trying to move
  • I'm trying to bury it 2 layers deeper in my documents

  • this is the folder I'm trying to move it to