outlier: Find value with largest difference from the mean

outlierR Documentation

Find value with largest difference from the mean

Description

Finds value with largest difference between it and sample mean, which can be an outlier.

Usage

outlier(x, opposite = FALSE, logical = FALSE)

Arguments

x

a data sample, vector in most cases. If argument is a dataframe, then outlier is calculated for each column by sapply. The same behavior is applied by apply when the matrix is given.

opposite

if set to TRUE, gives opposite value (if largest value has maximum difference from the mean, it gives smallest and vice versa)

logical

if set to TRUE, gives vector of logical values, and possible outlier position is marked by TRUE

Value

A vector of value(s) with largest difference from the mean.

Author(s)

Lukasz Komsta, corrections by Markus Graube

See Also

rm.outlier

Examples

set.seed(1234)
y=rnorm(100)
outlier(y)
outlier(y,opposite=TRUE)
dim(y) <- c(20,5)
outlier(y)
outlier(y,opposite=TRUE)

outliers documentation built on March 26, 2022, 9:05 a.m.

Related to outlier in outliers...