我无法直接在R代码中设置/更改工作目录。相反,我必须在文件浏览器选项卡中手动设置它

发布于 2025-02-05 19:37:28 字数 416 浏览 2 评论 0原文

由于某种原因,我无法在R代码本身中设置或更改工作目录。我将包含一个类似的行:

setwd("~/Documents/BeaverProject/HOBOData/Beav")

但是将遵循错误:

Error in setwd("~/Documents/BeaverProject/HOBOData/Beav") : 
  cannot change working directory

但是,如果我转到右下角的文件浏览器选项卡,然后单击“(齿轮图标)更多”,它为“提供”的选项。设置为工作目录“我可以用来将工作目录更改为所需的文件文件夹。

尽管这起作用,但这意味着我不能仅坐下来允许我的代码顺序运行,因为我必须在代码所需的每个点上手动更改工作目录。

有什么建议吗?

For some reason, I am unable to set or change my working directory in my R-code itself. I'll include a line such as:

setwd("~/Documents/BeaverProject/HOBOData/Beav")

But it will be followed with an error:

Error in setwd("~/Documents/BeaverProject/HOBOData/Beav") : 
  cannot change working directory

However, if I go to the file browser tab in the bottom right corner, and click "(gear icon) More", it provides an option to "Set as Working Directory" which I can use to change the working directory to the desired file folder.

While this works, it means that I can't just sit back and allow my code sequence to run because I have to manually change the working directory at every point in the code where it needs to.

Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文