in_interval: Determine if Value Lies within Interval
Description
This function determines whether elements of a numeric
vector x lie within boundaries [lo, hi).
Marginally slower than the Requivalent code x >=
lo & x < hi for small vectors; much faster for very
large vectors.
x <- runif(100); lo <- 0.5; hi <- 1
f <- function(x, lo, hi) {
return( x >= lo & x < hi )
}
stopifnot( all( in_interval( x, lo, hi ) == f(x, lo, hi) ) )