Skip to contents

Easily mutate a single column into multiple columns (~dummies+1), while retaining variable labels and order of the original factor variable.

Usage

col_to_binaries(data, col, var_separator = "___", label_separator = " - ")

Arguments

data

Data frame or tibble.

col

Single column. Tidy-select.

var_separator

Variable separator

scalar<character> // default: NULL (optional)

Separator between old variable name and categories.

label_separator

scalar<character> // default: NULL (optional)

Separator between old label name and new label part.

Value

Original data frame with the binary columns attached, containing new labels.