[Rd] Capturing the complete unevaluated expression corresponding to function (body + formals)
Hadley Wickham
hadley at rice.edu
Wed May 4 14:38:29 CEST 2011
Hi all,
Is there any way to capture the complete unevaluated expression
corresponding to a function? I want the equivalent of
x <- quote(function(x) x = 3)
But captured after the function is created. Body and formals each
captures a part, but is there a built in way to get the whole thing?
f <- function(x) x = 3
y <- call("function", formals(f), body(f), attr(f, "source"))
identical(x, y)
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
More information about the R-devel
mailing list