get_all_combinations: Convert a table of dummy variables to a table of its unique...

Description Usage Arguments Examples

Description

Convert a table of dummy variables to a table of its unique combinations

Usage

1
2
get_all_combinations(.data, new_var, clean_name = TRUE,
  clean_expr = "_.{1,}$", connector = "_")

Arguments

.data

data frame with only dummy variable to be converted

new_var

name of the new categorical variable to create for representing all combinations of the previous dummy variables.

clean_name, clean_expr, connector

technical inputs used for modifying resulting variables names.

Examples

1
2
3
4
5
6
7
library(dplyr)
library(tibble)
tibble(
       a = sample(c(0L, 1L), 25, replace = TRUE),
       b = sample(c(0L, 1L), 25, replace = TRUE)
       ) %>%
  get_all_combinations(c)

EBukin/lassopmm documentation built on June 12, 2019, 9:51 a.m.