Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

recipe_helpers

Developer Tools for processing XREGS (Regressors)


Description

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).

Usage

juice_xreg_recipe(recipe, format = c("tbl", "matrix"))

bake_xreg_recipe(recipe, new_data, format = c("tbl", "matrix"))

Arguments

recipe

A prepared recipe

format

One of:

  • tbl: Returns a tibble (data.frame)

  • matrix: Returns a matrix

new_data

Data to be processed by a recipe

Value

Data in either the tbl (data.frame) or matrix formats

Examples

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)

modeltime

The Tidymodels Extension for Time Series Modeling

v0.5.1
MIT + file LICENSE
Authors
Matt Dancho [aut, cre], Business Science [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.