How to set a working directory in R

In R, you can set a working directory in this way (I use C:/temp as an example).


You need to be careful about the slash.  Microsoft Windows uses backward slashes, "\", to indicate the folder structure.  R uses forward slash, "/" at least on my machine.  This may be OS-dependent, so to really determine which slash is used on your environment, try this command to know the currently working directory and see which is used:


I got this on my personal PC ("/" is used).


Alternatively, go to File and click on Change dir… to specify the working directly.


Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>