removeOutliers: Remove data outliers

View source: R/removeOutliers.R

removeOutliersR Documentation

Remove data outliers

Description

Remove data outliers based on the interquartile range.

Usage

removeOutliers(x, k = 1.5)

Arguments

x

vector of data.

k

factor to applied to the interquartile range (default = 1.5).

Details

The interquartile range IQR is computed from input dataset as IQR = Q3 - Q1, where Q1 is 25th percentile and Q3 is the 75th percentile. Values larger than Q3 + k * IQR and smaller than Q1 - k * IQR are deemed as outliers and substituted with NA's.

The default value of k is 1.5.

Value

A numeric vector with the same length as input vector.

Examples

mydata <- c(-10 * runif(10), runif(10))
removeOutliers(mydata)


simulariatools documentation built on Nov. 8, 2023, 5:07 p.m.