flat_pattern_filter: Flat pattern filter

flat_pattern_filterR Documentation

Flat pattern filter

Description

Performs a flat pattern filter over the dataset.

Usage

flat_pattern_filter(
  dataset,
  filter.function = "iqr",
  by.percent = TRUE,
  by.threshold = FALSE,
  red.value = 0
)

Arguments

dataset

A dataset object to filter.

filter.function

Filtering function to use. One of '"iqr"', '"rsd"', '"rnsd"', '"sd"', '"mad"', '"mean"', or '"median"'.

by.percent

Logical. If 'TRUE', the number of variables to filter will be defined as a percentage of the number of variables in the dataset; percentage is given by 'red.value'.

by.threshold

Logical. If 'TRUE', filtering selects variables where the filtering function is above or equal to a threshold.

red.value

Reduction value. If 'by.percent = TRUE', this is the percentage of variables to remove, or '"auto"' for automatic calculation. If 'by.threshold = TRUE', this is the minimum value needed to keep the variable.

Value

A dataset object with the same overall structure as the input, where 'dataset$data' has been filtered according to the selected flat-pattern criterion. Variables failing the selection rule are removed, the remaining dataset components are preserved, and 'dataset$description' is updated to record the filtering step.

Examples

if (requireNamespace("specmine.datasets", quietly = TRUE)) {
  data(propolis, package = "specmine.datasets")
  propolis_proc = missingvalues_imputation(propolis)
  propolis_proc = flat_pattern_filter(propolis_proc, "iqr",
    by.percent = TRUE, red.value = 75)
}


specmine documentation built on Aug. 5, 2026, 5:06 p.m.