data(biomass, package = "modeldata")
biomass_tr <- biomass[biomass$dataset == "Training", ]
biomass_te <- biomass[biomass$dataset == "Testing", ]
rec <- recipe(
HHV ~ carbon + hydrogen + oxygen + nitrogen + sulfur,
data = biomass_tr
)
rec_trans <- recipe(HHV ~ ., data = biomass_tr[, -(1:2)]) %>%
step_intercept(value = 2) %>%
step_scale(carbon)
rec_obj <- prep(rec_trans, training = biomass_tr)
with_intercept <- bake(rec_obj, biomass_te)
with_intercept
Run the code above in your browser using DataLab