BASIX.find.interval {BASIX} | R Documentation |
This function returns the positions of elements which are in a defined region.
BASIX.find.interval(vec,from,to,start=1)
vec |
base vector |
from |
left side |
to |
right side |
start |
the start position |
The function returns the position of the elements in vector vec
,
which are in a specific interval, defined by from
and to
,
starting from position start
.
The native R solution would be:
X <- (vec >= from) & (vec <= to)
ids <- which(X)
or the function findInterval()
, which
is just a little bit slower than
BASIX.interval
Bastian Pfeifer
vec <- c(1,3,5,7,9,10) from <- 5 to <- 8 BASIX.find.interval(vec,from,to,1)