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

2013-04-27 Thread Carlos Pita
ase') > base.transform(DataFrame({'a': IntVector((1,2,3))}), >a = parse('a+1')) > > Best, > > > L. > > > Your snippet returns: Out[10]: [Vector] a: [Vector, Vector, Vector] Guess each number in the original vector is jus

[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] Adding columns to DataFrames

2012-08-21 Thread Carlos Pita
(s/mm/newcol/ in the error message above) On Tue, Aug 21, 2012 at 2:25 PM, Carlos Pita wrote: > Mh, this is interesting: > > dataf = r['[<-'](dataf, 'newcol', R.IntVector([1,2,3])) > > => Error in `[<-.data.frame`(list(a = 1:3, b = 4:6, mm = 1:3)

Re: [Rpy] Adding columns to DataFrames

2012-08-21 Thread Carlos Pita
af = r['$<-'](dataf, 'newcol', R.IntVector([1,2,3])) => OK I think what is needed is a rx, rx2 equivalent for $. Is there something like that in rpy2? Regards -- Carlos On Tue, Aug 21, 2012 at 1:56 PM, Carlos Pita wrote: > Hi all, > > >>>

Re: [Rpy] Adding columns to DataFrames

2012-08-21 Thread Carlos Pita
Hi all, >>empty.rx2["New"] = [str(item) for item in range(len(empty.rownames))] >> RRuntimeError: Error in `[[<-.data.frame`(list(), "New", list("0", "1", >> "2", "3", "4", : argument "value" is missing, with no default >> Anything I'm doing wrong? > Not necessarily; I think