Re: [R] error in the function

2008-02-09 Thread jim holtman
a quick look at it shows you would be trying to access y[n+1] in the last part of that loop and that is greater than the number of entries in 'y' so you will get an NA and this is not legal for comparisons. On Feb 9, 2008 6:07 PM, mohamed nur anisah <[EMAIL PROTECTED]> wrote: > Dear lists, > > i

[R] error in the function

2008-02-09 Thread mohamed nur anisah
Dear lists, i want to find the non-overlapping interval values with this code: mysetdiff=function(x,y){ m=length(x) n=length(y) bx = logical(m) by = logical(n) for(i in 1:m){ for(j in 1:n){ if(x[i]<=y[j+1]){ bx[i] = T by[j] = T NA= N