check_outliers: Find potential outliers in a numeric vector

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

View source: R/check_outliers.R

Description

Identifies potential outliers in a numeric vector based on threshold values computed from input data.

Usage

1
2
check_outliers(x, method = "iqr", range = 3, na.rm = FALSE,
  title = NULL, plot = TRUE)

Arguments

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

Details

Currently only iqr method is implemented.

Method details:

Value

Returns a list with elements:

outlier

logical vector the same length as x where TRUE indicates point is outside threshold values and FALSE otherwise

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.

Author(s)

Michael Malick

See Also

quantile

Examples

1
2
3
 check_outliers(c(rnorm(100), 10, -10))
 check_outliers(exp(rnorm(100)), range = 5)
 check_outliers(exp(rnorm(100)))

MichaelMalick/r-malick documentation built on May 7, 2019, 4:56 p.m.