Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mapToIntervals.numeric

Maps values to intervals


Description

Maps values to intervals by returning an index vector specifying the (first) interval that each value maps to, if any.

Usage

## S3 method for class 'numeric'
mapToIntervals(x, intervals, includeLower=TRUE, includeUpper=TRUE, ...)

Arguments

x

A numeric vector of K values to be matched.

intervals

The N intervals to be matched against. If an Nx2 numeric matrix, the first column should be the lower bounds and the second column the upper bounds of each interval. If a numeric vector of length 2N, each consecutive pair should be the lower and upper bounds of an interval.

includeLower, includeUpper

If TRUE, the lower (upper) bound of each interval is included in the test, otherwise not.

...

Not used.

Value

Returns an integer vector of length K. Values that do not map to any interval have return value NA.

Author(s)

Henrik Bengtsson

See Also


R.utils

Various Programming Utilities

v2.10.1
LGPL (>= 2.1)
Authors
Henrik Bengtsson [aut, cre, cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.