1

I need to change the home directory for R / Rstudio, at the moment it works in the OneDrive folder , and it creates problems with sync. What I would like to change is not just the directory where libraries are installed. For example, I always get the .Rhistory file in the OneDrive directory, as well as the libraries. I would like "move" everything to another directory.

I tried with .Renviron file, but it still needs to be placed inside the OneDrive folder, and still I didn't succeed in have evrything moved in another place.

How can I do it?

UseR10085
  • 7,120
  • 3
  • 24
  • 54
Jrghen
  • 11
  • 2
  • setwd("your_path_goes_here") – Jakub.Novotny Oct 20 '20 at 18:09
  • 2
    @Jakub.Novotny he does not want to change only the working directory. – Pedro Faria Oct 20 '20 at 18:13
  • A possible duplicate of https://stackoverflow.com/questions/22432344/how-do-you-change-the-default-directory-in-rstudio-or-r – Jakub.Novotny Oct 20 '20 at 18:15
  • In RStudio, go to Tools, Global Options, and you'll have a window popup. In the General tab, the second line shows what default working directory you want when not in a project. Just click on the Browse button beside it and point to the location you want. – Phil Oct 20 '20 at 18:17
  • 1
    @Phil I tried your solution, i changed the working directory to the one i chose, the problem is that if I try to download a library, it will always store it in the original OneDrive folder. I would like to have everything moved to the new folder, basically making rstudio "forget" the One Drive directory – Jrghen Oct 20 '20 at 19:37
  • How about reinstalling R and RStudio to the desired folder? Is this an option? – Jakub.Novotny Oct 22 '20 at 09:39

0 Answers0