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
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
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
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