如何将 RStudio 设置回全局默认工作目录? [英] How to set back RStudio to global default working directory?

查看:87
本文介绍了如何将 RStudio 设置回全局默认工作目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在RStudio的General R Options中,在选项Default working directory (when not in a project):中,之前设置第一次特定目录出现这个符号~ 表示无目录或全局默认工作目录,例如:

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:

我的问题是我把目录设置为我的文档文件夹,我不能把它设置回~,因为Browse按钮不允许.你知道我怎样才能把它设置回 ~ 吗?

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 ~?

我想这样做是因为在我的新脚本中,我总是使用 setwd() 函数将此目录更改为其他路径.但是当我关闭 RStudio 时,我工作区中的所有对象都保存在这个使用 setwd() 设置的新目录中,然后每次我的工作区都必须手动保存到我的文档目录.因此,我更喜欢将其更改为全局默认工作目录~,我找不到如何执行此操作.

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.

提前致谢

推荐答案

对于 PC,转到您的 RStudio 用户设置文件位置(请注意,您可能需要在文件夹选项设置中显示隐藏文件夹):

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[你的名字]\AppData\Local\RStudio-Desktop\monitored\user-settings

C:\Users[your name]\AppData\Local\RStudio-Desktop\monitored\user-settings

使用记事本编辑您的 RStudio,更改或删除目录.

Edit your RStudio with Notepad, change or delete the directory.

以下是您可能拥有的:initialWorkingDirectory="C:/Users/[你的名字]/Documents"

Here is what you probably have: initialWorkingDirectory="C:/Users/[your name]/Documents"

更改为:initialWorkingDirectory="~"

Change to: initialWorkingDirectory="~"

希望有所帮助.

这篇关于如何将 RStudio 设置回全局默认工作目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆