clean_data: Clean Data by Removing MAD-based Outliers

View source: R/data_preprocessing.R

clean_dataR Documentation

Clean Data by Removing MAD-based Outliers

Description

Removes outliers from numeric data using the Median Absolute Deviation (MAD) method. Outliers are replaced with NA values.

Usage

clean_data(x, k = 3, take_log = FALSE)

Arguments

x

Numeric vector to clean.

k

Numeric threshold for outlier detection (default: 3).

take_log

Logical. Deprecated parameter. Log transformation should be done before calling this function.

Value

A numeric vector of the same length as x, where detected outliers have been replaced with NA.

See Also

detect_outliers_mad for the underlying outlier detection.

Examples

# Clean parameter values
params <- c(0.01, 0.012, 0.011, 0.1, 0.009, 0.011, 0.15)
clean_params <- clean_data(params)


topolow documentation built on Aug. 31, 2025, 1:07 a.m.