tests/testthat/_snaps/relevel.md

bad args

Code
  rec %>% step_relevel(sqft, ref_level = 23) %>% prep()
Condition
  Error in `step_relevel()`:
  Caused by error in `prep()`:
  x All columns selected for the step should be string or factor.
  * 1 integer variable found: `sqft`
Code
  rec %>% step_relevel(city, ref_level = "missing_level") %>% prep()
Condition
  Error in `step_relevel()`:
  Caused by error in `prep()`:
  ! The following column doesn't include required reference level "missing_level": `city`.
Code
  rec %>% step_relevel(city, ref_level = character(0)) %>% prep()
Condition
  Error in `step_relevel()`:
  Caused by error in `prep()`:
  ! `ref_level` must be a single string, not an empty character vector.

bake method errors when needed non-standard role columns are missing

Code
  bake(rec_1, sacr_te[, c(1, 3:ncol(sacr_te))])
Condition
  Error in `step_relevel()`:
  ! The following required column is missing from `new_data`: zip.

empty printing

Code
  rec
Message

  -- Recipe ----------------------------------------------------------------------

  -- Inputs 
  Number of variables by role
  outcome:    1
  predictor: 10

  -- Operations 
  * Re-order factor level to ref_level for: <none>
Code
  rec
Message

  -- Recipe ----------------------------------------------------------------------

  -- Inputs 
  Number of variables by role
  outcome:    1
  predictor: 10

  -- Training information 
  Training data contained 32 data points and no incomplete rows.

  -- Operations 
  * Re-order factor level to ref_level for: <none> | Trained

printing

Code
  print(rec)
Message

  -- Recipe ----------------------------------------------------------------------

  -- Inputs 
  Number of variables by role
  predictor: 9

  -- Operations 
  * Re-order factor level to ref_level for: zip
Code
  prep(rec)
Message

  -- Recipe ----------------------------------------------------------------------

  -- Inputs 
  Number of variables by role
  predictor: 9

  -- Training information 
  Training data contained 800 data points and no incomplete rows.

  -- Operations 
  * Re-order factor level to ref_level for: zip | Trained


tidymodels/recipes documentation built on Jan. 25, 2025, 7:30 a.m.