I am trying to create a function to undo target engineering in a tidymodels workflow. I need to know which steps apply to the outcome variable to undo the transformations and I am trying to use the un-exported function
eval_select_recipes(), which uses
When I run this, I get an empty vectors:
library(tidyverse) library(tidymodels) data <- dplyr::select(mtcars, cyl, mpg, disp, hp) mtcars_rec <- recipes::recipe(mpg ~ cyl + hp, data = data) %>% recipes::step_center(recipes::all_numeric(), -recipes::all_outcomes(), id = "centera") %>% recipes::step_scale(recipes::all_outcomes(), id = "scaleb") eval_select_recipes(quos = mtcars_rec$steps[]$terms, data = data, info = mtcars_rec$term_info) # named character(0)
It works perfectly when I run
prep(mtcars_rec) with the debugger, step inside the
prep() function, and then run
eval_select_recipes(quos = mtcars_rec$steps[]$terms, data = data, info = mtcars_rec$term_info) #  "cyl" "hp"
In both cases, identical inputs are passed to
eval_select() but one returns a length zero character and the other returns the correct named list.