Re: [Rpy] What is the equivalent of %in% in rpy2?

2011-09-12 Thread Laurent Gautier
On 2011-09-12 21:16, Artur Wroblewski wrote: > On Mon, Sep 12, 2011 at 12:26 PM, Laurent Gautier wrote: >> Probably not. >> >> R is doing a lot of things behind the hood. Sometimes it is good, sometimes >> it is bad. >> The code snippet given to you has a quadratic time-complexity ( O(nm) ). It >>

Re: [Rpy] What is the equivalent of %in% in rpy2?

2011-09-12 Thread Artur Wroblewski
On Mon, Sep 12, 2011 at 12:26 PM, Laurent Gautier wrote: > Probably not. > > R is doing a lot of things behind the hood. Sometimes it is good, sometimes > it is bad. > The code snippet given to you has a quadratic time-complexity ( O(nm) ). It > can be make linearithmic ( O(n log(m) ) ) simply: >

Re: [Rpy] What is the equivalent of %in% in rpy2?

2011-09-12 Thread Laurent Gautier
Probably not. R is doing a lot of things behind the hood. Sometimes it is good, sometimes it is bad. The code snippet given to you has a quadratic time-complexity ( O(nm) ). It can be make linearithmic ( O(n log(m) ) ) simply: from rpy2.robjects.vector import BoolVector ref = set(differential

Re: [Rpy] What is the equivalent of %in% in rpy2?

2011-09-12 Thread Luca Beltrame
In data lunedì 12 settembre 2011 11:45:32, Luca Beltrame ha scritto: > I forgot to add that I had to change the code to use list comprehensions > instead of generators, because otherwise I'd get a ValueError with "The > object does not have a length." (on rpy 2.2.x). Some follow ups on this issue

Re: [Rpy] What is the equivalent of %in% in rpy2?

2011-09-12 Thread Luca Beltrame
In data lunedì 12 settembre 2011 11:07:42, Luca Beltrame ha scritto: > Thanks Laurent, that did it. I forgot to add that I had to change the code to use list comprehensions instead of generators, because otherwise I'd get a ValueError with "The object does not have a length." (on rpy 2.2.x). --

Re: [Rpy] What is the equivalent of %in% in rpy2?

2011-09-12 Thread Luca Beltrame
In data lunedì 12 settembre 2011 10:55:33, Laurent Gautier ha scritto: > from rpy2.robjects.vector import BoolVector > select_b = BoolVector(x in differential for x in source.rx2('gene')) > mysubset = source.rx(select_b, True) Thanks Laurent, that did it. -- Luca Beltrame, Ph.D. - Translational G

Re: [Rpy] What is the equivalent of %in% in rpy2?

2011-09-12 Thread Laurent Gautier
from rpy2.robjects.vector import BoolVector select_b = BoolVector(x in differential for x in source.rx2('gene')) mysubset = source.rx(select_b, True) On 2011-09-12 10:33, Luca Beltrame wrote: Hello, in R I'm using something like this expression: mysubset<- source[source$gene %in% differentia

[Rpy] What is the equivalent of %in% in rpy2?

2011-09-12 Thread Luca Beltrame
Hello, in R I'm using something like this expression: mysubset <- source[source$gene %in% differential, ] where "differential" is a vector and "source" a dataframe. How can I replicate the use of %in% in rpy2? Thanks. -- Luca Beltrame, Ph.D. - Translational Genomics Unit Oncology Department,