encode_combinations: Encode combinations

encode_combinationsR Documentation

Encode combinations

Description

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.

Usage

encode_combinations(x, collapse = ", ")

Arguments

x

A data frame of binary values, which will be converted to logicals.

Value

A chracter vector of encoded combinations

Examples

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()

Deleetdk/kirkegaard documentation built on May 8, 2024, 12:27 a.m.