简体   繁体   English

重新启动 RStudio 或启动 R 并在 setwd(“D:/”) 中收到错误:无法更改工作目录

[英]Restarting RStudio or Starting R and receiving Error in setwd(“D:/”) : cannot change working directory

I was working on code recently and developed a file "D:/".我最近正在编写代码并开发了一个文件“D:/”。 I have since deleted this file as it did not help me with what I needed accomplished.我已经删除了这个文件,因为它没有帮助我完成我需要完成的事情。 However, now every time I open an instance of R or RStudio I receive the error "Error in setwd("D:/"): cannot change working directory".但是,现在每次打开 R 或 RStudio 的实例时,我都会收到错误“setwd 中的错误(“D:/”):无法更改工作目录”。

This also happens when I try to run particular functions in R.当我尝试在 R 中运行特定功能时,也会发生这种情况。 Is it possible to get this error to stop showing up entirely as I am not actively attempting to change my working directory.由于我没有积极尝试更改我的工作目录,是否有可能完全停止显示此错误。

You can reset your RStudio setting by removing or renaming the custom setting stored in a RStudio-Desktop .您可以通过删除或重命名存储在RStudio-Desktop中的自定义设置来重置RStudio设置。 When that happens RStudio creates a new directory to store the settings.发生这种情况时, RStudio会创建一个新目录来存储设置。 Here is what you can do on windows machines.这是您可以在 windows 机器上执行的操作。 Close RStudio and do the following.关闭RStudio并执行以下操作。

1) Start --> Run 1) 开始 --> 运行

2) Type %localappdata%\RStudio-Desktop on the dialogue. 2) 在对话框中输入 %localappdata%\RStudio-Desktop。

3) right click and rename the folder just in case you need it later 3)右键单击并重命名文件夹以防万一您以后需要它

4) Start RStudio 4) 启动 RStudio

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM