Re: [R] Fwd: Dynamic regex/sub changes to function

2014-09-22 Thread Rolf Turner
On 23/09/14 12:18, Bert Gunter wrote: Daniel: Do you understand what a parse tree is? Paraphrasing a quote attributed to Feynman: "If you think you understand what a parse tree is, then you don't understand what a parse tree is." :-) cheers, Rolf -- Rolf Turner Technical Editor AN

[R] Fwd: Dynamic regex/sub changes to function

2014-09-22 Thread Bert Gunter
(failed to cc the list) Daniel: Do you understand what a parse tree is? Try this: f <- function(x){ + y <- x^2 + z <- sin(y+2) + } > body(f) { y <- x^2 z <- sin(y + 2) } > as.list(body(f)) [[1]] `{` [[2]] y <- x^2 [[3]] z <- sin(y + 2) > body(f)[[c(3,3,1)]] sin > class(body(f)) [