Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/check_outliers.R
Identifies potential outliers in a numeric vector based on threshold values computed from input data.
1 2 |
x |
numeric vector |
method |
method for finding potential outliers |
range |
multiplier of IQR for outlier threshold |
na.rm |
logical, should NA values be removed |
title |
string, optional plot title placed on top outside margin |
plot |
logical, should a plot of results be produced |
Currently only iqr
method is implemented.
Method details:
iqr
identifies an "outlier threshold" based on the
interquartile range (IQR) of the data. The upper/lower
threshold values are calculated as +/- IQR * range.
Returns a list with elements:
outlier |
logical vector the same length as |
index |
indices of x that are outside threshold |
threshold |
vector of length two giving lower and upper thresholds |
n.outlier |
number of points outside threshold values |
If plot = TRUE
, then a plot of x
is produced with potential
outliers highlighted in red. Dashed horizontal lines indicate outlier
thresholds.
Michael Malick
1 2 3 | check_outliers(c(rnorm(100), 10, -10))
check_outliers(exp(rnorm(100)), range = 5)
check_outliers(exp(rnorm(100)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.