R- Getting/Setting working directory


Hi ,
I am little confused with the relative get/set of working directory in R.

The Absolute one is fine as we have to directly copy the address and pass it to the getwd() and setwd()

Kindly help with the relative one.

Thanks on advance!

Happy Learning!



If you’re familiar with *nix directory structure and commands, it’s similar.

Let’s assume the current working directory is /home/neelmani (assuming it’s a *nix system).

So getwd() should return /home/neelmani. If, however, you wish to set /home/neelmani/rprog/project as your working directory, pass the argument as follows: setwd("./rprog/project").

Hope this helps.


Thanks anon for the reply!!