Re: [R] setting the current working directory to the location of the source file

From: Marcin Gomulka <>
Date: Sun, 13 Jun 2010 15:01:57 +0200

On Fri, Jun 11, 2010 at 11:30 AM, Henrik Bengtsson <>wrote:

> Isn't this what source(..., chdir=TRUE) is for? See help(source).
not really. Imagine you give someone a script, but you have no control over where and how they run it. They shouldn't be required to put in the chdir parameter.
Say, the script outputs a plot to a file (pdf,png,...) and you want the file to be created next to the source script, as the user would expect it.


        [[alternative HTML version deleted]] mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sun 13 Jun 2010 - 13:03:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 13 Jun 2010 - 13:30:30 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive