Learn R Programming

OLCPM (version 0.1.1)

outlier.remove: remove outliers

Description

This function removes outliers in the data, which are far from the sample median.

Usage

outlier.remove(x, rg = 3)

Value

a list containing the following:

x

a new data vector with outliers replaced with \(NA\). The original missing values in the data are preserved.

id

the locations of the outliers in the data vector.

Arguments

x

a numeric data vector.

rg

a positive number indicating how the outliers are defined; see details.

Author

Yong He, Xinbing Kong, Lorenzo Trapani, Long Yu

Details

An outlier is detected if it deviates from the sample median more than rg times interquantile range.

Examples

Run this code

a=c(1:5,NA,10000)
outlier.remove(a,3)

Run the code above in your browser using DataLab