Three standard rules:
"iqr": outsideQ1 - k*IQR/Q3 + k*IQR(Tukey's rule,k = 1.5)."zscore": absolute z-score abovethreshold(default 3)."robust": absolute modified z-score using the median and MAD abovethreshold(default 3.5); resistant to the outliers it is detecting.
Usage
detect_outliers(x, method = c("iqr", "zscore", "robust"), threshold = NULL)Value
A list: method, n (non-missing count), n_outliers, pct,
is_outlier (a logical vector aligned to x, FALSE for NA), and
bounds (lower/upper, where applicable).
Examples
detect_outliers(c(1, 2, 3, 4, 100), method = "iqr")
#> $method
#> [1] "iqr"
#>
#> $n
#> [1] 5
#>
#> $n_outliers
#> [1] 1
#>
#> $pct
#> [1] 20
#>
#> $is_outlier
#> [1] FALSE FALSE FALSE FALSE TRUE
#>
#> $bounds
#> lower upper
#> -1 7
#>