View source: R/modeltime-accuracy-table.R
table_modeltime_accuracy | R Documentation |
Converts results from modeltime_accuracy()
into
either interactive (reactable
) or static (gt
) tables.
table_modeltime_accuracy(
.data,
.round_digits = 2,
.sortable = TRUE,
.show_sortable = TRUE,
.searchable = TRUE,
.filterable = FALSE,
.expand_groups = TRUE,
.title = "Accuracy Table",
.interactive = TRUE,
...
)
.data |
A |
.round_digits |
Rounds accuracy metrics to a specified number of digits.
If |
.sortable |
Allows sorting by columns.
Only applied to |
.show_sortable |
Shows sorting.
Only applied to |
.searchable |
Adds search input.
Only applied to |
.filterable |
Adds filters to table columns.
Only applied to |
.expand_groups |
Expands groups dropdowns.
Only applied to |
.title |
A title for static ( |
.interactive |
Return interactive or static tables. If |
... |
Additional arguments passed to |
Groups
The function respects dplyr::group_by()
groups and thus scales with multiple groups.
Reactable Output
A reactable()
table is an interactive format that enables live searching and sorting.
When .interactive = TRUE
, a call is made to reactable::reactable()
.
table_modeltime_accuracy()
includes several common options like toggles for sorting and searching.
Additional arguments can be passed to reactable::reactable()
via ...
.
GT Output
A gt
table is an HTML-based table that is "static" (e.g. non-searchable, non-sortable). It's
commonly used in PDF and Word documents that does not support interactive content.
When .interactive = FALSE
, a call is made to gt::gt()
. Arguments can be passed via ...
.
Table customization is implemented using a piping workflow (%>%
).
For more information, refer to the GT Documentation.
A static gt
table or an interactive reactable
table containing
the accuracy information.
library(dplyr)
library(lubridate)
library(timetk)
library(parsnip)
library(rsample)
# Data
m750 <- m4_monthly %>% filter(id == "M750")
# Split Data 80/20
splits <- initial_time_split(m750, prop = 0.9)
# --- MODELS ---
# Model 1: prophet ----
model_fit_prophet <- prophet_reg() %>%
set_engine(engine = "prophet") %>%
fit(value ~ date, data = training(splits))
# ---- MODELTIME TABLE ----
models_tbl <- modeltime_table(
model_fit_prophet
)
# ---- ACCURACY ----
models_tbl %>%
modeltime_calibrate(new_data = testing(splits)) %>%
modeltime_accuracy() %>%
table_modeltime_accuracy()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.