
Last chance! 50% off unlimited learning
Sale ends in
Coerces decomposed time-series objects to tibble format.
sw_tidy_decomp(x, timetk_idx = FALSE, rename_index = "index", ...)
Returns a tibble
object.
A time-series object of class stl
, ets
, decomposed.ts
, HoltWinters
,
bats
or tbats
.
When TRUE
, uses a timetk index (irregular, typically date or datetime) if present.
Enables the index column to be renamed.
Not used.
sw_tidy_decomp
is designed
to coerce time-series objects with decompositions to tibble
objects.
A regularized time index is always constructed. If no time index is
detected, a sequential index is returned as a default.
The index column name can be changed using the rename_index
argument.
library(dplyr)
library(forecast)
library(sweep)
# Decompose ETS model
USAccDeaths %>%
ets() %>%
sw_tidy_decomp()
# Decompose STL object
USAccDeaths %>%
stl(s.window = 'periodic') %>%
sw_tidy_decomp()
Run the code above in your browser using DataLab