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).

setwd("C:/temp")

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 […]