[R] Path to R script

Duncan Murdoch murdoch.duncan at gmail.com
Wed May 12 22:10:37 CEST 2010


On 12/05/2010 3:31 PM, Johannes W. Dietrich wrote:
> There is certainly a trivial solution for my question, but I can't 
> find the answer in the documentation.
>
> I need a platform independent method to obtain the file path of the 
> current R script.
>
> My working group uses R on several machines with different operating 
> systems including Mac OS X, Windows and Linux, and for obvious 
> reasons the file hierarchies are very different. Therefore, it would 
> be useful to be able to address data files and external procedures 
> relative to the path of the script.

I'm not sure there's a trivial solution, because there are so many 
different ways to run a script.  How are you running it?  Are you using 
the same method on all platforms?

Duncan Murdoch



More information about the R-help mailing list