isWithinInterval {tilingArray}R Documentation

Test whether a vector of numbers is within a vector of intervals

Description

Test whether a vector of numbers is within a vector of intervals

Usage

isWithinInterval(x, start, end)

Arguments

x Numeric vector.
start Numeric vector.
end Numeric vector of same length as start.

Details

For each value x[i], this function tests whether it lies within the interval from start[j] to end[j], i.e. whether start[j] <= x[i] <= end[j]. The result is returned in a logical matrix whose rows correspond to i and columns to j.

The implementation of this function is naive. It does not use loops within R, but can have a large memory consumption, corresponding to several matrices of size length(x)*length(start)

Value

Matrix of size length(x)*length(start).

Author(s)

W. Huber <huber@ebi.ac.uk>

Examples

  x = 1:8
  start = seq(2, 6, by=2)
  end   = seq(4, 8, by=2)
  isWithinInterval(x, start, end)

[Package tilingArray version 1.2.0 Index]