Cannot permanently Change R Working Directory - Windows 10


Cannot permanently Change R Working Directory - Windows 10



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





Are you using it within RStudio? It might be affecting the starting directory, despite your better efforts.
– r2evans
2 days ago




1 Answer
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


.Rprofile



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.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Export result set on Dbeaver to CSV

Opening a url is failing in Swift