[R] Change working directory

Gabor Grothendieck ggrothendieck at gmail.com
Sat Nov 14 11:36:36 CET 2009


On Fri, Nov 13, 2009 at 6:24 PM, Don MacQueen <macq at llnl.gov> wrote:
> In R for Macintosh, there is a Preferences setting that will do this.
> You can also drag and drop a file onto the R icon and I believe it will
> change the working directory to the directory that contains the file.
>
> On unix-like systems, using the command line, it's whatever directory you
> start R in.
>
> I don't use R on Windows, so I don't know there, but I imagine there may be
> a preferences setting, or perhaps the drag and drop method works. Or maybe
> create a shortcut in the directory you want to be the working directory?

On Windows if you start R using Rgui.bat from the command line then it
will start in whatever directory you were in (as in UNIX).

Rgui.bat is a single file with no dependencies so just copy it to any
directory on your path. It will automatically find R using the
registry and then start it up.

Rgui.bat is found in the batchfiles distribution whose home page is:
http://batchfiles.googlecode.com




More information about the R-help mailing list