markfairbanks / tidytable

Tidy interface to 'data.table'
https://markfairbanks.github.io/tidytable/
Other
450 stars 32 forks source link

`get_dummies.()` misses `NA`s of numerical columns #482

Closed markfairbanks closed 2 years ago

markfairbanks commented 2 years ago
pacman::p_load(tidytable)

df <- tidytable(x = c(1, NA, 3))

df %>%
  get_dummies.(x)
#> # A tidytable: 3 × 4
#>       x   x_1   x_3  x_NA
#>   <dbl> <int> <int> <int>
#> 1     1     1     0    NA
#> 2    NA    NA    NA    NA
#> 3     3     0     1    NA