[R] File > Save As...
Hadley Wickham
hadley at rice.edu
Wed Mar 16 14:06:09 CET 2011
> No, defaults are evaluated in the evaluation frame of the function. That's
> why you can use local variables in them, e.g. the way rgamma uses 1/rate as
> a default for scale.
Oops, yes, I was getting confused with promises - non-missing
arguments are promises evaluated in the parent frame.
> But the point isn't evaluation here: the point is the parsing. A function
> gets its source attribute when it is parsed, so getSrcFilename needs to be
> passed something that was parsed in the script.
Still, it would be nice to have a function that, by default, would
return the location of the calling script. You can also hack
something together using sys.frames(), but it would be nice to have
official R support for it.
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
More information about the R-help
mailing list