Posts

Showing posts from June, 2015

How to permanently set R working directory

Image
       Using R Studio If you are using RStudio for R Programming just go to Tools -> Global Options... -> General one can set the default working directory. Also under Session one can Set Working Directory To Source File Location and To Files Pane Location with single click and with a graphical tool to any directory. Setting a convenient default is of course useful, but at least I have at most one project (in general meaning of the word and not just in R meaning of the word) in one folder so I have to switch the working directory anyway between projects. Using  getwd, setwd R is always pointed at a directory on your computer. You can find out which directory by running the getwd (get working directory) function; this function has no arguments. To change your working directory, use setwd and specify the path to the desired folder. getwd() setwd(dir)     dir – Specify a working directory. This may be from the root directory (starting with / on a Mac), it may