Tcanuth
Tcanuth

Reputation: 3

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

Upvotes: 0

Views: 2035

Answers (1)

MHammer
MHammer

Reputation: 1314

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.

Upvotes: 1

Related Questions