Re: [R] Needing a better solution to a lookup problem.

2012-03-15 Thread Davis, Brian
elapsed 0.700.000.71 Brian -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Wednesday, March 14, 2012 2:44 PM To: Davis, Brian Cc: r-help@R-project.org Subject: Re: [R] Needing a better solution to a lookup problem. On Mar 14, 2012, at 3:27 PM, Davis

[R] Needing a better solution to a lookup problem.

2012-03-14 Thread Davis, Brian
I have a solution (actually a few) to this problem, but none are computationally efficient enough to be useful. I'm hoping someone can enlighten me to a better solution. I have data frame of chromosome/position pairs (along with other data for the location). For each pair I need to determine

Re: [R] Needing a better solution to a lookup problem.

2012-03-14 Thread David Winsemius
On Mar 14, 2012, at 3:27 PM, Davis, Brian wrote: I have a solution (actually a few) to this problem, but none are computationally efficient enough to be useful. I'm hoping someone can enlighten me to a better solution. I have data frame of chromosome/position pairs (along with other

Re: [R] Needing a better solution to a lookup problem.

2012-03-14 Thread Mikhail Titov
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Davis, Brian Sent: Wednesday, March 14, 2012 2:28 PM To: r-help@R-project.org Subject: [R] Needing a better solution to a lookup problem. I have a solution (actually a few

Re: [R] Needing a better solution to a lookup problem.

2012-03-14 Thread ilai
You could try doing it without a loop (.C or other): (rgnsnp - merge(region,snps)) (rgnsnp[with(rgnsnp,STOP=POS POS = START),]) Here is my test for merge+search on 100k/200k: fdf1 - data.frame(chr=1:10,p=runif(10),d=sample(10)) fdf2 -

Re: [R] Needing a better solution to a lookup problem.

2012-03-14 Thread Davis, Brian
Subject: Re: [R] Needing a better solution to a lookup problem. You could try doing it without a loop (.C or other): (rgnsnp - merge(region,snps)) (rgnsnp[with(rgnsnp,STOP=POS POS = START),]) Here is my test for merge+search on 100k/200k: fdf1 - data.frame(chr=1:10,p=runif(10),d