问题
In the General R Options of RStudio, in the option Default working directory (when not in a project):, previous to set for the first time a specific directory appears this symbol ~ that means No directory or Global default working directory, like here:
My problem is that I set the directory to My documents folder, and I can't set it back to ~ because the Browsebutton doesn't allow it. Do you know how can I set it back to ~?
I would like to do that because in my new scripts I'm changing always this directory to other paths with the setwd() function. But when I close RStudio all the objects from my workspace are saved in this new directory set with setwd(), then I have to save manually every time my workspace to My documents directory. Therefore, I prefer to change it to Global default working directory ~, and I can't find how to do this.
Thanks in advance
回答1:
For PC, go to your RStudio user-settings file location (Note you may have to show hidden folders in your folder options settings):
C:\Users[your name]\AppData\Local\RStudio-Desktop\monitored\user-settings
Edit your RStudio with Notepad, change or delete the directory.
Here is what you probably have: initialWorkingDirectory="C:/Users/[your name]/Documents"
Change to: initialWorkingDirectory="~"
Hope that helps.
来源:https://stackoverflow.com/questions/31594993/how-to-set-back-rstudio-to-global-default-working-directory