Skip to content

tidy.recipe() throws error for zero-step recipes #867

@EmilHvitfeldt

Description

@EmilHvitfeldt

tidy.recipe() should return a zero row tibble for empty recipes instead of throwing an error. This is making step_detect() error when used on empty recipes.

library(recipes)

recipe(~., data = mtcars) %>%
  step_center(all_predictors()) %>%
  tidy()
#> # A tibble: 1 × 6
#>   number operation type   trained skip  id          
#>    <int> <chr>     <chr>  <lgl>   <lgl> <chr>       
#> 1      1 step      center FALSE   FALSE center_uXNNk

recipe(~., data = mtcars) %>%
  tidy()
#> Error: No steps in recipe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions