Add a Model into a Modeltime Table

add_modeltime_model(object, model, location = "bottom")

Arguments

object

Multiple Modeltime Tables (class mdl_time_tbl)

model

A model of class model_fit or a fitted workflow object

location

Where to add the model. Either "top" or "bottom". Default: "bottom".

See also

Examples

# \donttest{ library(tidymodels)
#> ── Attaching packages ────────────────────────────────────── tidymodels 0.1.4 ──
#> broom 0.7.9 tibble 3.1.5 #> dials 0.0.10 tidyr 1.1.4 #> ggplot2 3.3.5 tune 0.1.6 #> infer 1.0.0 workflows 0.2.3 #> modeldata 0.1.1 workflowsets 0.1.0 #> purrr 0.3.4 yardstick 0.0.8 #> recipes 0.1.17
#> ── Conflicts ───────────────────────────────────────── tidymodels_conflicts() ── #> x purrr::discard() masks scales::discard() #> x dplyr::filter() masks stats::filter() #> x dplyr::lag() masks stats::lag() #> x tidyr::spread() masks greybox::spread() #> x recipes::step() masks stats::step() #> Use suppressPackageStartupMessages() to eliminate package startup messages
model_fit_ets <- exp_smoothing() %>% set_engine("ets") %>% fit(value ~ date, training(m750_splits))
#> frequency = 12 observations per 1 year
m750_models %>% add_modeltime_model(model_fit_ets)
#> # Modeltime Table #> # A tibble: 4 × 3 #> .model_id .model .model_desc #> <int> <list> <chr> #> 1 1 <workflow> ARIMA(0,1,1)(0,1,1)[12] #> 2 2 <workflow> PROPHET #> 3 3 <workflow> GLMNET #> 4 4 <fit[+]> ETS(A,A,A)
# }