Cannot permanently Change R Working Directory - Windows 10

余生长醉 提交于 2020-01-06 14:15:14

问题


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.

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?

Thanks in advance


回答1:


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

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.



来源:https://stackoverflow.com/questions/51093818/cannot-permanently-change-r-working-directory-windows-10

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!