[R] set working directory to current source directory

Kenn Konstabel lebatsnok at gmail.com
Tue Aug 14 02:50:47 CEST 2012


When you close R it asks whether to save the workspace. I often say
"yes" and later start R by double clicking on that workspace (named
.Rdata) -- then the wd is automatically set. Alternatively you can
have setwd("X:/some/thing") at the beginning of your source file.

On Tue, Aug 14, 2012 at 3:40 AM, Sachinthaka Abeywardana
<sachin.abeywardana at gmail.com> wrote:
> Hi all,
>
> Is there a way to get cran R to set the working directory to be wherever
> the source file is? Each time I work on a project on different computers I
> keep having to set the working directory which is getting quite annoying.
>
> Thanks,
> Sachin
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list