Learn R Programming

sfsmisc (version 0.9-4)

rrange: Robust Range using Boxplot `Quartiles'

Description

Compute a robust range, i.e. the usual range() as long as there are no outliers, using the ``whisker boundaries'' of boxplot.

Usage

rrange(x, range=1, coef = 1.5, na.rm = TRUE)

Arguments

x
numeric vector the robust range of which shall be computed.
range
number for S compatibility; 1.5 * range is equivalent to coef.
coef
numeric multiplication factor definying the outlier boundary, see ``Details'' below.
na.rm
logical indicating how NA values should be handled; they are simply dropped when na.rm = TRUE as by default.

Value

  • numeric vector c(m,M) with $m \le M$ which is (not strictly) inside range(x) = c(min(x),max(x)).

Details

The robust range is really just what boxplot.stats(x, coef=coef) returns as the whisker boundaries. This is the most extreme values x[j] still inside median plus/minus coef * IQR.

See Also

range, fivenum, boxplot.

Examples

Run this code
stopifnot(rrange(c(1:10,1000)) == c(1,10))

Run the code above in your browser using DataLab