Re: [R] two difficult loop

2016-06-14 Thread greg holly
Thanks a lot Jim. I am struggling to solve the problem.I do appreciate for your helps and advice. Greg On Tue, Jun 14, 2016 at 3:39 AM, Jim Lemon wrote: > Hi Greg, > This is obviously a problem with the data. The first error indicates > that the sequence of integers

Re: [R] two difficult loop

2016-06-14 Thread Jim Lemon
Hi Greg, This is obviously a problem with the data. The first error indicates that the sequence of integers regrange[1]:regrange[2] is too long to be allocated. Most likely this is because one or both of the endpoints are infinite. Maybe if you can find where the NAs are you can fix it. Jim On

Re: [R] two difficult loop

2016-06-13 Thread greg holly
Hi Jim; I do apologize if bothering. I have run on the real data and here is the error message I got: Thanks, Greg start end Error in regrange[1]:regrange[2] : result would be too long a vector In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In

Re: [R] two difficult loop

2016-06-13 Thread Jim Lemon
Hi Greg, Okay, I have a better idea now of what you want. The problem of multiple matches is still there, but here is a start: # this data frame actually contains all the values in ref in the "reg" field map<-read.table(text="reg p rate 10276 0.700 3.867e-18 71608 0.830 4.542e-16 29220 0.430

Re: [R] two difficult loop

2016-06-12 Thread greg holly
Hi Jim; Thanks so much for this info. I did not know this as I am very much new in R, So do you think that, rather than using unique !duplicated would be better to use? Thanks in advance, Greg On Sun, Jun 12, 2016 at 7:06 PM, Jim Lemon wrote: > Hi Greg, > You've got a

Re: [R] two difficult loop

2016-06-12 Thread greg holly
Hi Bert; I do appreciate for this. I need check your codes on task2 tomorrow at my office on the real data as I have difficulty (because a technical issue) to remote connection. I am sure it will work well. I am sorry that I was not able to explain my first question. Basically Values in ref

Re: [R] two difficult loop

2016-06-12 Thread Jim Lemon
Hi Greg, You've got a problem that you don't seem to have identified. Your "reg" field in the "map" data frame can define at most 10 unique values. This means that each value will be repeated about 270 times. Unless there are constraints you haven't mentioned, we would expect that in 135 cases

Re: [R] two difficult loop

2016-06-12 Thread Bert Gunter
Greg: I was not able to understand your task 1. Perhaps others can. My understanding of your task 2 is that for each row of ref, you wish to find all rows,of map such that the reg values in those rows fall between the reg1 and reg2 values in ref (inclusive change <= to < if you don't want the

[R] two difficult loop

2016-06-12 Thread greg holly
Dear all; I have two data sets, data=map and data=ref). A small part of each data set are given below. Data map has more than 27 million and data ref has about 560 rows. Basically I need run two different task. My R codes for these task are given below but they do not work properly. I