Description Usage Arguments Value
View source: R/consolidate_categories_other.R
Two options, controlled by construct_indic_other
:
(FALSE) Construct modified version of original categorical variable. Overwrite some level values with 'other', according to minimum frequency threshold. Modified variable result takes '_consol' suffix.
(TRUE) Construct binary indicator variable strictly to convey, 'is other', according to minimum frequency threshold.
1 2 3 4 5 6 7 | consolidate_categories_other(
df,
varname_cat,
threshold,
value_consol = "OTHER",
construct_indic_other = FALSE
)
|
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'. |
Modified version of input data frame.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.