id_outliers: A function that identifies outliers in a vector of numeric...

Description Usage Arguments Details Value Examples

View source: R/idoutliers.R

Description

Identify outliers using the standard IQR approach or assuming a normal distribution and identifying outliers using probability. See details below for description of the calculations.

Usage

1
2
id_outliers(x = NULL, method = c("quantile", "prob", "logprob"), p = 0.05,
  tail = c("both", "left", "right"))

Arguments

x

A vector that is of class numeric, or coercible to one

method

The method to use in order to identify outliers. This should be one of "quantile" or "prob"

p

If method "prob" is selected, this parameter defines the probability threshold for outlier classification

tail

[DOC NEEDED]

Details

IQR approach: outliers are defined as observations that fall above 1.5 times the third quantile and below 1.5 times the first quantile.

Probability approach: assuming a normal distribution of values, outliers are flagged as values that have a 5 sample data. This method uses both tails of the distribution (e.g. values that are below and above the mean)

Value

A logical vector where TRUE identifies the position of an outlier in the input argument

Examples

1
2
3
4
#vec <- rnorm(100, 0, 1)
#bout <- id_outliers(vec)
#dt <- data.table(Values = vec, bOutlier = bout)
#dt[bOutlier == TRUE]

bfatemi/easydata documentation built on Oct. 7, 2019, 4:35 p.m.