grapes-In-grapes: Find if value belongs to a set of intervals

Description Usage Arguments Value Author(s) Examples

Description

Returns whether numeric values on the left-hand side of the operator fall within any of the specified intervals on the right-hand side. Intervals can be specified using either two-column matrices or Intervals objects from the intervals package.

Usage

1
2
3
x %In% Intv

x %within% Intv

Arguments

x

A vector of numeric values

Intv

A set of intervals, defined by a two-column matrix of endpoints or an Intervals object

Value

A vector of logicals, which are true if x[i] belongs to any of the intervals in the set.

Author(s)

Simon Barthelme

Examples

1
2
3
4
start <- c(0, 1, 2)
end <- c(.5, 1.3, 3)
intv <- cbind(start, end) # The first interval is 0-0.5, second is 1-1.3, etc.
c(0, .6, 1.5, 3) %In% intv

eyelinker documentation built on June 4, 2021, 1:10 a.m.