BASIX.find.interval: Positions of elements in a defined region

View source: R/BASIX.find.interval.R

BASIX.find.intervalR Documentation

Positions of elements in a defined region

Description

This function returns the positions of elements which are in a defined region.

Usage


BASIX.find.interval(vec,from,to,start=1)

Arguments

vec

base vector

from

left side

to

right side

start

the start position

Details

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

Author(s)

Bastian Pfeifer

Examples

vec  <- c(1,3,5,7,9,10)
from <- 5
to   <- 8
BASIX.find.interval(vec,from,to,1)

BASIX documentation built on June 13, 2022, 5:05 p.m.