Find Interval Indices
Find indices i
in vector xs
such that either x=xs[i]
or such that xs[i]<x<xs[i+1]
or xs[i]>x>xs[i+1]
.
findintervals(x, xs)
x |
single number. |
xs |
numeric vector, not necessarily sorted. |
Contrary to findInterval
, the vector xs
in
findintervals
need not be sorted.
Vector of indices in 1..length(xs)
.
If none is found, returns integer(0)
.
If x
is equal to the last element in xs
, the index
length(xs)
will also be returned.
xs <- zapsmall(sin(seq(0, 10*pi, len=100))) findintervals(0, xs) # 1 10 20 30 40 50 60 70 80 90 100
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.