Skip to contents

Identifies outliers using the interquartile range (IQR) method. Values beyond Q1 - multiplierIQR or Q3 + multiplierIQR are flagged.

Usage

detect_outliers_iqr(data, variable = "wave_height", multiplier = 1.5)

Arguments

data

Data frame with the variable to check

variable

Name of the variable (default: "wave_height")

multiplier

IQR multiplier for outlier threshold (default: 1.5)

Value

The input data frame with an additional is_outlier logical column.

Examples

data <- data.frame(x = c(1:20, 100))
detect_outliers_iqr(data, variable = "x")
#>      x is_outlier
#> 1    1      FALSE
#> 2    2      FALSE
#> 3    3      FALSE
#> 4    4      FALSE
#> 5    5      FALSE
#> 6    6      FALSE
#> 7    7      FALSE
#> 8    8      FALSE
#> 9    9      FALSE
#> 10  10      FALSE
#> 11  11      FALSE
#> 12  12      FALSE
#> 13  13      FALSE
#> 14  14      FALSE
#> 15  15      FALSE
#> 16  16      FALSE
#> 17  17      FALSE
#> 18  18      FALSE
#> 19  19      FALSE
#> 20  20      FALSE
#> 21 100       TRUE