[Rd] Capturing the expression representing the body of a function

Hadley Wickham hadley at rice.edu
Mon May 2 21:21:00 CEST 2011


Hi all,

What's the preferred way of capturing the expression representing the
contents of a function?

* body(write.csv) gives me a braced expression
* body(write.csv)[-1] gives me a mangled call
* as.list(body(write.csv)[-1]) gives me a list of calls
* as.expression(as.list(body(write.csv)[-1])) is what I want but seems
like too much work

Any suggestions?

Thanks,

Hadley

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



More information about the R-devel mailing list