View source: R/trans_outliers_boxplot.R
| outliers_boxplot | R Documentation |
Removes outliers from numeric columns using Tukey's boxplot rule: values below Q1 - alpha·IQR or above Q3 + alpha·IQR are flagged as outliers.
outliers_boxplot(alpha = 1.5)
alpha |
boxplot outlier threshold (default 1.5, but can be 3.0 to remove extreme values) |
The default alpha=1.5 corresponds to the standard boxplot whiskers; alpha=3 is used for extreme outliers.
returns an outlier object
Tukey, J. W. (1977). Exploratory Data Analysis. Addison‑Wesley.
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.