Create dummy variables from bins.

rbin_create(data, predictor, bins)

Arguments

data

A data.frame or tibble.

predictor

Variable for which dummy variables must be created.

bins

An object of class rbin_manual or rbin_quantiles or rbin_equal_length or rbin_winsorized.

Value

data with dummy variables.

Examples

k <- rbin_manual(mbank, y, age, c(29, 39, 56)) rbin_create(mbank, age, k)
#> # A tibble: 4,521 x 20 #> age job marital education default balance housing loan contact day #> <int> <fct> <fct> <fct> <fct> <dbl> <fct> <fct> <fct> <int> #> 1 34 tech~ married tertiary no 297 yes no cellul~ 29 #> 2 49 serv~ married secondary no 180 yes yes unknown 2 #> 3 38 admi~ single secondary no 262 no no cellul~ 3 #> 4 47 serv~ married secondary no 367 yes no cellul~ 12 #> 5 51 self~ single secondary no 1640 yes no unknown 15 #> 6 40 unem~ married secondary no 3382 yes no unknown 14 #> 7 58 reti~ married secondary no 1227 no no cellul~ 14 #> 8 32 unem~ married primary no 309 yes no teleph~ 13 #> 9 46 blue~ married secondary no 922 yes no teleph~ 18 #> 10 32 serv~ married tertiary no 0 no no cellul~ 21 #> # ... with 4,511 more rows, and 10 more variables: month <fct>, duration <int>, #> # campaign <int>, pdays <int>, previous <int>, poutcome <fct>, y <fct>, #> # `age_<_39` <dbl>, `age_<_56` <dbl>, `age_>=_56` <dbl>