quasiquoting in R?
Oct. 28th, 2009 12:46 am
< gusl > I have a function 'fun' to which I want to pass the name of another
function 'f'. The name of 'f' is to be printed and then 'f' is to be
called. [00:40]
< gusl > I'm wondering whether I want to pass the name of the function... or
whether it's possible to pass the function itself, and get 'fun' to
compute its name. [00:41]
< gusl > I thought about using quote, but realized that it can't help
me... since it's not a quasiquote [00:43]
I'm not very hopeful of a solution along these lines... Fortunately, it's rare than I miss Lisp features (at least ever since I stopped using Java).
---
UPDATE: eval saved the day! It's still a bit cumbersome, since I need to call 'parse'.
eval(parse(text="square(5)"))
eval(parse(text="square"))(5) Also, the #R channel has a bot named "eval"!