calculate_outlier_value: Identify Outliers

View source: R/calculate_outlier_value.R

calculate_outlier_valueR Documentation

Identify Outliers

Description

This function uses standard statistical methods to calculate the value the identifies outliers above or below it on a distribution.

Usage

calculate_outlier_value(x, tail, method = "iqr", na.rm = FALSE)

Arguments

x

A numeric vector.

tail

takes "upper" or "lower", determining which side of the distribution to calculate an outlier identification value.

method

"iqr", the default, adds 1.5 times the interquartile range to the 75th percentile for the upper value or subtracts 1.5 times the interquartile range from the 25th percentile for the lower value. "sd" uses the mean plus or minus 3 times the standard deviation of the distribution.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

Value

A numeric vector of length one.

Examples

vec <- rnorm(1000, mean = 0, sd = 1)
calculate_outlier_value(vec, tail = "upper")
calculate_outlier_value(vec, tail = "lower", method = "sd")


ldimartin0/ladtools documentation built on June 8, 2022, 3:30 p.m.