sw_sweep: Tidy forecast objects

Description Usage Arguments Details Value See Also Examples

View source: R/sw_sweep.R

Description

Tidy forecast objects

Usage

1
sw_sweep(x, fitted = FALSE, timetk_idx = FALSE, rename_index = "index", ...)

Arguments

x

A time-series forecast of class forecast.

fitted

Whether or not to return the fitted values (model values) in the results. FALSE by default.

timetk_idx

If timetk index (non-regularized index) is present, uses it to develop forecast. Otherwise uses default index.

rename_index

Enables the index column to be renamed.

...

Additional arguments passed to tk_make_future_timeseries()

Details

sw_sweep is designed to coerce forecast objects from the forecast package into tibble objects in a "tidy" format (long). The returned object contains both the actual values and the forecasted values including the point forecast and upper and lower confidence intervals.

The timetk_idx argument is used to modify the return format of the index.

The index column name can be changed using the rename_index argument.

Value

Returns a tibble object.

See Also

tk_make_future_timeseries()

Examples

1
2
3
4
5
6
7
8
9
library(forecast)
library(sweep)
library(dplyr)

# ETS forecasts
USAccDeaths %>%
    ets() %>%
    forecast(level = c(80, 95, 99)) %>%
    sw_sweep()

sweep documentation built on July 10, 2020, 5:13 p.m.