recipe_helpers | R Documentation |
Wrappers for using recipes::bake
and recipes::juice
to process data
returning data in either data frame
or matrix
format (Common formats needed
for machine learning algorithms).
juice_xreg_recipe(recipe, format = c("tbl", "matrix"))
bake_xreg_recipe(recipe, new_data, format = c("tbl", "matrix"))
recipe |
A prepared recipe |
format |
One of:
|
new_data |
Data to be processed by a recipe |
Data in either the tbl
(data.frame) or matrix
formats
library(dplyr)
library(timetk)
library(recipes)
library(lubridate)
predictors <- m4_monthly %>%
filter(id == "M750") %>%
select(-value) %>%
mutate(month = month(date, label = TRUE))
predictors
# Create default recipe
xreg_recipe_spec <- create_xreg_recipe(predictors, prepare = TRUE)
# Extracts the preprocessed training data from the recipe (used in your fit function)
juice_xreg_recipe(xreg_recipe_spec)
# Applies the prepared recipe to new data (used in your predict function)
bake_xreg_recipe(xreg_recipe_spec, new_data = predictors)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.