Create dummy variables for categorical data.

rbin_factor_create(data, predictor)

Arguments

data

A data.frame or tibble.

predictor

Variable for which dummy variables must be created.

Value

A tibble with dummy variables.

Examples

upper <- c("secondary", "tertiary") out <- rbin_factor_combine(mbank, education, upper, "upper") rbin_factor_create(out, education)
#> # A tibble: 4,521 x 19 #> age job marital default balance housing loan contact day month #> <int> <fct> <fct> <fct> <dbl> <fct> <fct> <fct> <int> <fct> #> 1 34 tech~ married no 297 yes no cellul~ 29 jan #> 2 49 serv~ married no 180 yes yes unknown 2 jun #> 3 38 admi~ single no 262 no no cellul~ 3 feb #> 4 47 serv~ married no 367 yes no cellul~ 12 may #> 5 51 self~ single no 1640 yes no unknown 15 may #> 6 40 unem~ married no 3382 yes no unknown 14 may #> 7 58 reti~ married no 1227 no no cellul~ 14 aug #> 8 32 unem~ married no 309 yes no teleph~ 13 may #> 9 46 blue~ married no 922 yes no teleph~ 18 nov #> 10 32 serv~ married no 0 no no cellul~ 21 nov #> # ... with 4,511 more rows, and 9 more variables: duration <int>, #> # campaign <int>, pdays <int>, previous <int>, poutcome <fct>, y <fct>, #> # education <fct>, education_unknown <dbl>, education_upper <dbl>