[R] Working directories... Again
Duncan Murdoch
murdoch at stats.uwo.ca
Fri Feb 26 19:20:25 CET 2010
On 26/02/2010 12:55 PM, Allen L wrote:
> Dear R forum,
> I've looked many places for this and figure there must be an easy way to
> implement.
>
> I want to set the working directory in my script to the place where the R
> code is located.
> Something like:
> >setwd(directory where this script is found).
If you wrote the script, then you know where you put it, so the simplest
way is just to hard code the directory at the top of the script.
If you want to be able to move the script around and have it still work,
that doesn't work. See the thread in this list entitled "Re: [R]
relative file path" from about 4 days ago for some dirty methods to
handle that case.
Duncan Murdoch
More information about the R-help
mailing list