get_rename_tribbles | R Documentation |
Renaming categorical variables and their levels, for instance for summary tables, can be fiddly. This
function generates code in which only the new names need to be modified, and which can then be passed
to either rename_cat_variables
or directly to cat_var_table_mi
get_rename_tribbles( dat, ..., show = TRUE, which = c("both", "vars", "levels"), max_levels = 20 )
dat |
A dataframe that contains the variables - only used to extract their possible levels. |
... |
The variables to be included in the rename tribbles. |
show |
Logical - should the output be printed to the console. In any case, it is returned invisibly |
which |
Should tribble code be generated for variables ( |
max_levels |
The maximum number of levels before a variable is dropped from the levels_tribble. Defaults to 20 |
Only categorical variables should be passed to the function if code for levels is requested. If a variable has more than 20 distinct values, it is dropped from the levels-tribble-code
Code to be edited and passed to tibble::tribble() to create var_names and level_names arguments for
rename_cat_variables
and cat_var_table_mi
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.