Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

baking step_discretize() errors when applied to a single NA. #1350

Open
EmilHvitfeldt opened this issue Jul 16, 2024 · 0 comments
Open

baking step_discretize() errors when applied to a single NA. #1350

EmilHvitfeldt opened this issue Jul 16, 2024 · 0 comments
Labels
bug an unexpected problem or unintended behavior tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day

Comments

@EmilHvitfeldt
Copy link
Member

library(recipes)

rec <- recipe(~ mpg, data = mtcars) |>
  step_discretize(mpg, min_unique = 4) |>
  prep()

rec |>
  bake(data.frame(mpg = c(NA, 3)))
#> # A tibble: 2 × 1
#>   mpg  
#>   <fct>
#> 1 <NA> 
#> 2 bin1

rec |>
  bake(data.frame(mpg = c(3)))
#> # A tibble: 1 × 1
#>   mpg  
#>   <fct>
#> 1 bin1

rec |>
  bake(data.frame(mpg = c(NA)))
#> Error in cut.default(new_data, object$breaks, labels = labs, include.lowest = TRUE): 'x' must be numeric
@EmilHvitfeldt EmilHvitfeldt added bug an unexpected problem or unintended behavior tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day labels Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day
Projects
None yet
Development

No branches or pull requests

1 participant