other_rm | R Documentation |
Takes a dataframe (frequencies) and replaces the usual variations of "Other please specify" into Other. Also standardizes "None of the above" and "Prefer not to say" options. Additionally, removes all extra text after parentheses opening. Does this for the 'label', 'variable', and 'group_var' vars.
other_rm(dataset, var = NULL, remove = FALSE)
dataset |
The name of the data frame for the function to modify, usually piped in after running freqs. You almost never need any arguments in this function. |
var |
DEFAULT = NULL; If kept at NULL, it will already remove parenthetical text in 'label', 'variable', and 'group_var' vars. You can add an additional variable by specifying it here. |
remove |
DEFAULT = FALSE; If set to TRUE, will remove categories of "Other" and "None of the above" from the frequencies |
frequencies <- tibble::tibble(
label = c(
'Brand 1',
'Brand 2',
'Brand 3',
'Other (please specify)',
'None of the above brands...'
),
result = c(.25, .15, .20, .10, .30),
other_var = c('x', 'y', 'z', 'z (test)', 'None')
)
frequencies %>% other_rm(remove = TRUE)
frequencies %>% other_rm(var = other_var)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.