encode_combinations | R Documentation |
Given a data frame of binary values, encode the combinations of TRUE values. Useful for combining multiple yes/no options in different variables into a single column, e.g. self-identified race/ethnicity.
encode_combinations(x, collapse = ", ")
x |
A data frame of binary values, which will be converted to logicals. |
A chracter vector of encoded combinations
tibble(A = c(T, F, F, T, F), B = c(F, T, F, F, F), C = c(F, F, T, F, F), D = c(F, F, F, T, F)) %>% encode_combinations()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.