| 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 |
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 |
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.
If
timetk_idx = FALSE, a regularized time index is always constructed. This may be in the format of numeric values (e.g. 2010.000) or the higher orderyearmonandyearqtrclasses from thezoopackage. A higher order class is attempted to be returned.If
timetk_idx = TRUEand a timetk index is present, an irregular time index will be returned that combines the original time series (i.e. date or datetime) along with a computed future time series created usingtk_make_future_timeseries()from thetimetkpackage. The...can be used to pass additional arguments totk_make_future_timeseries()such asinspect_weekdays,skip_values, etc that can be useful in tuning the future time series sequence.
The index column name can be changed using the rename_index argument.
Value
Returns a tibble object.
See Also
Examples
library(forecast)
library(sweep)
library(dplyr)
# ETS forecasts
USAccDeaths %>%
ets() %>%
forecast(level = c(80, 95, 99)) %>%
sw_sweep()