data(biomass, package = "modeldata")
biomass$one_value <- 1
biomass_tr <- biomass[biomass$dataset == "Training", ]
biomass_te <- biomass[biomass$dataset == "Testing", ]
rec <- recipe(HHV ~ carbon + hydrogen + oxygen +
nitrogen + sulfur + one_value,
data = biomass_tr
)
zv_filter <- rec %>%
step_zv(all_predictors())
filter_obj <- prep(zv_filter, training = biomass_tr)
filtered_te <- bake(filter_obj, biomass_te)
any(names(filtered_te) == "one_value")
tidy(zv_filter, number = 1)
tidy(filter_obj, number = 1)
Run the code above in your browser using DataLab