hi!! Below I have 4 columns vector of c and d which are unequal in length.These c and d have 2 columns each where these 2 columns represent an interval values. I easily get these overlapping interval values by using these code: s<-apply(c,1,rev) aa<-apply(d,1,function(x)apply(s<=x,2,any)) My huge problem is i need to do this detection using the loops and i'm seriously not good in doing that. I've tried to read the R manual but still failed to do so. Can somebody help me as i'm a new user to R!! Thanks in advance.. c d 17130612 17587118 17712302 18100404 17712302 18221688 21203780 21387314 21225764 21387314 25012714 30748348 25012714 30748348 33852816 34384588 33852816 34480192 34794536 35996440 36012944 36209144 36252300 36280276 36737468 36971144 43693832 43878548 --------------------------------- [[alternative HTML version deleted]]