[R] turning R expressions into functions?
Jochen Voß
voss at seehuhn.de
Mon Jul 2 15:54:02 CEST 2012
Dear Greg,
many thanks for your anwer.
On Sat, Jun 30, 2012 at 11:39:07AM -0600, Greg Snow wrote:
> Look at the replicate function, it takes an expression (does not need
> a function) and runs that expression the specified number of times.
> Will that accomplish what you want without needing to worry about
> substitute, quote, eval, etc.?
Yes, this is very similar to what I want to achieve.
One of the main differences is that 'replicate' builds
up a list of all call results, and for my measurements
I want to avoid the resulting (time and memory) overhead.
But I did look at the implementation of 'replicate'
and this is where I took the trick of using
eval.parent and substitute from.
All the best,
Jochen
--
http://seehuhn.de/
More information about the R-help
mailing list