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
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.