无法永久更改R工作目录-Windows 10 [英] Cannot permanently Change R Working Directory - Windows 10
问题描述
我在Windows 10笔记本电脑上运行R 3.5.0 64位。
我可以为我的工作空间设置工作目录,但无法进行永久更改。
I am running R 3.5.0 64 bit on my Windows 10 laptop. I can set the Working directory fine for my work space but I am unable to make a permanent change. Each time I reload it, it does not stick.
我在右键单击图标时将开始于文件路径更改为属性下的新目录。
I changed my Start In file path to the new directory under properties when right clicking the icon.
我还在Rprofile.site文件中的文件路径中添加了setwd()
I have also added setwd() with my file path in the Rprofile.site file
无论我做什么,它都会继续
No matter what I do, it continues to revert back to documents when I run getwd() in R when I open it new.
任何人对我能做些什么以使其保持粘性有任何想法?
Anyone have any ideas on what I can do to make it stick?
p>
预先感谢
Thanks in advance
推荐答案
您可以使用 .Rprofile
是一种在启动时运行脚本/命令的方法。
在此处了解有关.Rprofile文件的信息R编程
You could go the route of using an .Rprofile
which is a way to run scripts / commands on startup.
Read about .Rprofile files here in Efficient R Programming
@ r2evans也提到过,如果您使用的是RStudio,则可以使用一个选项来设置默认的工作目录。在工具->全局选项菜单的常规部分下。
Also, has has been mentioned by @r2evans, if you're using RStudio, there is an option for setting the default working directory. It's under the General section of the Tools -> Global Options menu.
这篇关于无法永久更改R工作目录-Windows 10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!