This is an alternative to
findInterval(x, b, rightmost.closed=TRUE)
which seems to be faster when b
is equally spaced
and the length of x
is large.
If labels=FALSE
(the default), the result is an integer vector
giving, for each value x[i]
, the index j
of the interval that
contains x[i]
, such that b[j] <= x[i] < b[j + 1]
.
If labels=TRUE
, the result is a factor, and the levels are
synthetic labels for the intervals, similar to those produced by
findInterval
.