Skip to content
Prev 164887 / 398503 Next

Find all numbers in a certain interval

On Dec 16, 2008, at 7:19 AM, Antje wrote:

            
I see your point, but I must point out that no cases would ever  
satisfy that construction.
That would be a different within.interval function than I suggested,  
but you could certainly create one which accepted a vector.

within.interval <- function(x, y) { min(y) < x & x < max(y) }
----------
 > within.interval2 <- function(x,y) { min(y) < x & x < max(y)}

 > y <- c(-.1, -.2, .1,.2)

 > which(within.interval2(DF$a,y))
[1]  7 13 14 17