sw_sweep {sweep}R Documentation

Tidy forecast objects

Description

Tidy forecast objects

Usage

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

library(forecast)
library(sweep)
library(dplyr)

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



[Package sweep version 0.2.5 Index]