R: Outlier

Outlier {DescTools} | R Documentation

## Outlier

### Description

Return outliers following Tukey's boxplot definition.

### Usage

    Outlier(x, method = c("boxplot"), na.rm = FALSE)

### Arguments

`x` | a (non-empty) numeric vector of data values.
`method` | the method to be used. So far only Tukey's boxplot rule is implemented.
`na.rm` | logical. Should missing values be removed? Defaults to FALSE.

### Details

Outlier detection is a tricky problem and should be handled with care. We implement only Tukey's boxplot rule as a rough idea of spotting extreme values.

### Value

the values of x lying outside the whiskers in a boxplot

### Author(s)

Andri Signorell <andri@signorell.net>

### See Also

`boxplot`

### Examples

    Outlier(d.pizza$temperature, na.rm=TRUE)

    # find the corresponding rows
    d.pizza[which(d.pizza$temperature %in% Outlier(d.pizza$temperature, na.rm=TRUE)),]

    # outliers for the drivers
    tapply(d.pizza$temperature, d.pizza$driver, Outlier, na.rm=TRUE)

    # see also
    boxplot(temperature ~ driver, d.pizza)$out

[Package DescTools version 0.99.25 Index]