outliersZ: Identify outliers using Z-score cut-off method.

View source: R/outliersZ.R

outliersZR Documentation

Identify outliers using Z-score cut-off method.

Description

outliersZ is used to identify outliers in vectors using Z-score cut-off

Usage

outliersZ(x, zCutOff = 1.96, replaceOutliersWith = NA,
outlierIndices = FALSE, showZValues = FALSE, digits = 2)

Arguments

x

a vector of numbers

zCutOff

value to use as cutoff (1.96 is a common value)

replaceOutliersWith

if value is an outlier, what to replace it with? NA by default

outlierIndices

return index/position of outlier

showZValues

if TRUE, will show z score of each value

digits

how many digits/decimals to round output to

Value

A vector with outliers identified (default converts outliers to NA)

Note

This detection method is not as robust as the median absolute deviation outlier detection method.

Author(s)

Hause Lin

See Also

outliers_mad

Examples

example <- c(1, 3, 3, 6, 8, 10, 10, 1000) # 1000 is an outlier
outliersZ(example)
outliersZ(example, zCutOff = 3.0)
outliersZ(example, zCutOff = 1.0, replaceOutliersWith = -999)
outliersZ(example, zCutOff = 1.0, outlierIndices = TRUE)
outliersZ(example, zCutOff = 1.0, showZValues = TRUE)

hauselin/hausekeep documentation built on Feb. 3, 2023, 3:09 p.m.