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'))
Best,
L.
On 2013-04-27 09:23, Carlos Pita wrote:
> 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=<<a+1>>)
>
> The part <<a+1>> is the one I want to achieve somehow. I know I could just
> call:
>
> r('transform(data.frame(a=c(1,2,3)), a=a+1)')
>
> But this requires to pass the data frame inline which in this case is
> ok because of its tiny size, but it's not the general case. Also, I
> could add the data frame to the environment variable x and then call:
>
> r('transform(x, a=a+1)')
>
> But as I've already said I would like to know if there is some way to
> pass the a+1 expression as an object.
>
> Best regards
> --
> Carlos
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
> _______________________________________________
> rpy-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rpy-list
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
rpy-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list