confine: Confine values to the given bounds

Description Arguments Value Usage Details Author(s) See Also Examples

Description

Given a sequence this function confines the sequence values to within the specified bounds. This behavior is equivalent to clipping in digital signal processing.

Arguments

x

A numeric vector

min.level

The lower bound

max.level

The upper bound

Value

A sequence with values outside of [min.level, max.level] clipped to those values

Usage

confine(x, min.level, max.level) confine(x, min.level=-1, max.level=1)

Details

The confine function can be thought of a transform that limits the range of a sequence. Any values outside the range [min.level, max.level] are adjusted to be exactly min.level or max.level.

Care should be taken when using this function as it is not always a good idea to change the value of outliers. Sometimes it is better to remove these values from a data set instead.

Author(s)

Brian Lee Yung Rowe

See Also

quantize

Examples

1
confine(seq(-2,2, by=.1))

zatonovo/lambda.tools documentation built on May 4, 2019, 9:11 p.m.