Reputation: 11
I have a file which is saved on a different drive than RStudio and I'm trying to set it as the working directory.
setwd(dir)
Where dir is the copy and pasted file path(windows) string. I get the error
Error in setwd("dir") :
cannot change working directory
Since dir has been copied as a path, I cannot work out what the error might be.
Edit: I should have mentioned I have changed the all the \ to / in the file path.
Solved: quotation marks needed around file path.
Upvotes: 1
Views: 3252
Reputation: 51
You should paste the windows path and change backslashes to forward slashes. Did you do this?
setwd("Z:/path")
Upvotes: 1