consolidate_categories_other: Consolidate categorical variable's rarely observed levels...

Description Usage Arguments Value

View source: R/consolidate_categories_other.R

Description

Two options, controlled by construct_indic_other:

Usage

1
2
3
4
5
6
7
consolidate_categories_other(
  df,
  varname_cat,
  threshold,
  value_consol = "OTHER",
  construct_indic_other = FALSE
)

Arguments

df

A data frame, with categorical variable whose rarely observed levels should be consolidated.

varname_cat

Character name of categorical variable.

threshold

Minimum share of observations with categorical level v, below which, v enters 'other'.

value_consol

Value which constitutes the newly consolidated 'other' category.

construct_indic_other

Does construct binary indicator variable strictly to convey, 'is_other'.

Value

Modified version of input data frame.


abrahamalex13/doPrepExplore documentation built on Jan. 27, 2021, 4:30 a.m.