tidymodels / recipes

Pipeable steps for feature engineering and data preprocessing to prepare for modeling
https://recipes.tidymodels.org
Other
569 stars 112 forks source link

step_unknown #355

Closed topepo closed 5 years ago

topepo commented 5 years ago

A step to convert NA values to "unknown" in categorical data, such as

library(tidymodels)
#> Registered S3 methods overwritten by 'ggplot2':
#>   method         from 
#>   [.quosures     rlang
#>   c.quosures     rlang
#>   print.quosures rlang
#> Registered S3 method overwritten by 'xts':
#>   method     from
#>   as.zoo.xts zoo
#> ── Attaching packages ────────────────────────────────────────────────────────────────────────────────── tidymodels 0.0.2 ──
#> ✔ broom     0.5.1          ✔ purrr     0.3.2     
#> ✔ dials     0.0.2          ✔ recipes   0.1.5.9000
#> ✔ dplyr     0.8.0.1        ✔ rsample   0.0.4     
#> ✔ ggplot2   3.1.1          ✔ tibble    2.1.3     
#> ✔ infer     0.4.0          ✔ yardstick 0.0.2     
#> ✔ parsnip   0.0.2.9000
#> ── Conflicts ───────────────────────────────────────────────────────────────────────────────────── tidymodels_conflicts() ──
#> ✖ purrr::discard() masks scales::discard()
#> ✖ dplyr::filter()  masks stats::filter()
#> ✖ dplyr::lag()     masks stats::lag()
#> ✖ recipes::step()  masks stats::step()

table(credit_data$Job, useNA = "always")
#> 
#>     fixed freelance    others   partime      <NA> 
#>      2805      1024       171       452         2

Created on 2019-06-29 by the reprex package (v0.2.1)

github-actions[bot] commented 3 years ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex https://reprex.tidyverse.org) and link to this issue.