mergeSmallFactorLevels: Merges small levels of factors into new level.

View source: R/mergeSmallFactorLevels.R

mergeSmallFactorLevelsR Documentation

Merges small levels of factors into new level.

Description

Merges factor levels that occur only infrequently into combined levels with a higher frequency.

Usage

mergeSmallFactorLevels(
  task,
  cols = NULL,
  min.perc = 0.01,
  new.level = ".merged"
)

Arguments

task

(Task)
The task.

cols

(character) Which columns to convert. Default is all factor and character columns.

min.perc

(numeric(1))
The smallest levels of a factor are merged until their combined proportion w.r.t. the length of the factor exceeds min.perc. Must be between 0 and 1. Default is 0.01.

new.level

(character(1))
New name of merged level. Default is “.merged”

Value

Task, where merged levels are combined into a new level of name new.level.

See Also

Other eda_and_preprocess: capLargeValues(), createDummyFeatures(), dropFeatures(), normalizeFeatures(), removeConstantFeatures(), summarizeColumns(), summarizeLevels()


berndbischl/mlr documentation built on Aug. 15, 2024, 4:20 p.m.