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)
Run the code above in your browser using DataLab