[R] File > Save As...

Hadley Wickham hadley at rice.edu
Tue Mar 15 21:45:17 CET 2011


>> The bigger issue is that R can't tell the location of an open script,
>> which makes it harder to create new versions of existing work....
>
> But it can.  If you open a script and choose save, it will be saved to the
> same place.  Or do you mean an executing script?  There are indirect ways to
> find the name of the executing script.  For example,
> in R-devel (to become 2.13.0 next month), you can do this:
>
>
> cat("This file is ", getSrcFilename(function(){}, full=TRUE), "\n")
>
> The getSrcFilename() function will be new in 2.13.0.  You can do the same in
> earlier versions, but you need to program it yourself.

Could getSrcFilename() gain a default argument so that
getSrcFilename() would by default return the path of the executing
script?

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list