Skip to contents

se_dummy is an internal helper function used to generate dummy (0/1) variables based on the combinations of multiple categorical variables. It is primarily used by se_prop() to support grouped dummy encoding.

Usage

se_dummy(data, ..., sep = "_")

Arguments

data

A data frame or tibble.

...

One or more categorical columns (unquoted or quoted) whose combinations will be used to generate joint dummy variables.

sep

A character string to separate combined category names (default is "_").

Value

A tibble including all original data columns and additional dummy columns representing all unique combinations of the provided categorical variables.

Examples

df <- tibble::tibble(gender = c("male", "female"), country = c("US", "Other"))
se_dummy(df, gender, country)
#> # A tibble: 2 × 4
#>   gender country joint_female_Other joint_male_US
#>   <chr>  <chr>                <int>         <int>
#> 1 male   US                       0             1
#> 2 female Other                    1             0