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:

<DataFrame - Python:0xa78e84c / R:0xa302a60>
[Vector]
  a: <class 'rpy2.robjects.vectors.Vector'>
  <Vector - Python:0xa7926ac / R:0xa6ffbc0>
[Vector, Vector, Vector]

Regards,
Carlos

On Sat, Apr 27, 2013 at 5:40 AM, Laurent Gautier <lgaut...@gmail.com> wrote:
> 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.
>
>
>

Your snippet returns:

Out[10]:
<DataFrame - Python:0xa7e7fac / R:0xa2b4a50>
[Vector]
  a: <class 'rpy2.robjects.vectors.Vector'>
  <Vector - Python:0xa7e8eec / R:0x9a86648>
[Vector, Vector, Vector]

Guess each number in the original vector is just being replaced by an
expression.
>
> 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
>> rpy-list@lists.sourceforge.net
>> 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
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to