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

2011-05-02 Thread Hadley Wickham
> The body of a function isn't an expression, it's a language object.  A > language object is represented internally as a pairlist, while an expression > is represented as a generic vector, i.e. the thing that list() gives. That doesn't agree with the documentation of is.language which implies a l

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

2011-05-02 Thread Gabor Grothendieck
On Mon, May 2, 2011 at 4:11 PM, Duncan Murdoch wrote: > On 02/05/2011 3:21 PM, Hadley Wickham wrote: >> >> 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] gi

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

2011-05-02 Thread Duncan Murdoch
On 02/05/2011 3:21 PM, Hadley Wickham wrote: 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