[Rpy] Passing expressions to be evaluated by functions

2013-04-27 Thread Carlos Pita
Hi all, I would like to know if there is a way to pass an r expression to be lazy evaluated by a function. I mean as in transform or within. For example: r.transform(r['data.frame'](a=r.c(1,2,3)), a=<>) The part <> is the one I want to achieve somehow. I know I could just call: r('transform(d

Re: [Rpy] Passing expressions to be evaluated by functions

2013-04-27 Thread Laurent Gautier
Hi, Would the following help ? from rpy2.rinterface import parse from rpy2.robjects.vectors import DataFrame, IntVector from rpy2.robjects.packages import importr base = importr('base') base.transform(DataFrame({'a': IntVector((1,2,3))}), a = parse('a+1')) Be

Re: [Rpy] Passing expressions to be evaluated by functions

2013-04-27 Thread Carlos Pita
Hi Laurent, no it doesn't. Indeed I had tried with parse before asking but to no avail. My code was: r.transform(r['data.frame'](a=r.c(1,2,3)), a=parse('a+1')) Whose output is the same than your code's: [Vector] a: [Vector, Vector, Vector] Regards, Carlos On Sat, Apr 27, 2013 at 5:40 A

Re: [Rpy] Passing expressions to be evaluated by functions

2013-04-27 Thread Laurent Gautier
I see. In R's `transform()` there is the following line: e <- eval(substitute(list(...)), `_data`, parent.frame()) (`_data` being the data.frame) This will work with R's `language` elements, but unfortunately not `expression` ones (which what is coming out out of `parse()`). I'd need (or so