outliers_boxplot: Outlier removal by boxplot (IQR rule)

View source: R/trans_outliers_boxplot.R

outliers_boxplotR Documentation

Outlier removal by boxplot (IQR rule)

Description

Removes outliers from numeric columns using Tukey's boxplot rule: values below Q1 - alpha·IQR or above Q3 + alpha·IQR are flagged as outliers.

Usage

outliers_boxplot(alpha = 1.5)

Arguments

alpha

boxplot outlier threshold (default 1.5, but can be 3.0 to remove extreme values)

Details

The default alpha=1.5 corresponds to the standard boxplot whiskers; alpha=3 is used for extreme outliers.

Value

returns an outlier object

References

Tukey, J. W. (1977). Exploratory Data Analysis. Addison‑Wesley.

Examples

# code for outlier removal
out_obj <- outliers_boxplot() # class for outlier analysis
out_obj <- fit(out_obj, iris) # computing boundaries
iris.clean <- transform(out_obj, iris) # returning cleaned dataset

#inspection of cleaned dataset
nrow(iris.clean)

idx <- attr(iris.clean, "idx")
table(idx)
iris.outliers_boxplot <- iris[idx,]
iris.outliers_boxplot

daltoolbox documentation built on Nov. 5, 2025, 7:09 p.m.