sw_tidy_decomp: Coerces decomposed time-series objects to tibble format.

View source: R/sw_tidy_decomp.R

sw_tidy_decompR Documentation

Coerces decomposed time-series objects to tibble format.

Description

Coerces decomposed time-series objects to tibble format.

Usage

sw_tidy_decomp(x, timetk_idx = FALSE, rename_index = "index", ...)

Arguments

x

A time-series object of class stl, ets, decomposed.ts, HoltWinters, bats or tbats.

timetk_idx

When TRUE, uses a timetk index (irregular, typically date or datetime) if present.

rename_index

Enables the index column to be renamed.

...

Not used.

Details

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.

Value

Returns a tibble object.

Examples

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



sweep documentation built on July 9, 2023, 7:10 p.m.