Dummy-code a categorical variable

dummyvar(data)

Arguments

data

one column of categorical data to be dummy-coded

Value

tibble with dummy variables

Examples

mytest=data.frame(attribute=factor(c('a','a','b','c','c')))
dummyvar(mytest)
#> # A tibble: 5 × 3
#>   attributea attributeb attributec
#>        <dbl>      <dbl>      <dbl>
#> 1          1          0          0
#> 2          1          0          0
#> 3          0          1          0
#> 4          0          0          1
#> 5          0          0          1