[R] Lazy evaluation in function call
Thorn
thorn.thaler at rdls.nestle.com
Tue May 4 16:26:43 CEST 2010
Hi everybody,
how is it possible to refer to an argument passed to a function in the
function call? What I like to do, is something like
f <- function(x,y) x+y
f(2, x) # should give 4
The problem is of course that x is only known inside the function. Of course I
could specify something like
f(z<-2,z)
but I'm just curious whether it is possible to use a fancy combination of
eval, substitute or quote ;)
BR, thorn
More information about the R-help
mailing list