Cannot permanently Change R Working Directory - Wi

2019-08-30 06:38发布

问题:

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.



标签: r directory