View source: R/forecast_helpers.R
| fg_sweep | R Documentation |
fg_sweep Augments a sweep::sw_sweep() output into fgts_dygraph() forecastdataset format. See
Introduction to Sweep
fg_sweep(swept_data, confidence = 80)
swept_data |
Data resulting from a |
confidence |
(Default: 80) Confidence interval (in percent) to display |
Forecast Helpers
data.table suitable for passing into fgts_dygraph() via the forecastdataset parameter
if (
requireNamespace("forecast", quietly = TRUE) &
requireNamespace("timetk", quietly = TRUE) &
requireNamespace("sweep", quietly = TRUE)
) {
fcst_eqtypx <- timetk::tk_ts(eqtypx[,.(date,QQQ)]) |> forecast::ets() |>
forecast::forecast(h=30) |> sweep::sw_sweep(timetk_idx=TRUE)
fcst_in <- fg_sweep(fcst_eqtypx)
toplot <- eqtypx[,.(date,IBM,QQQ)]
fgts_dygraph(toplot,title="With Forecasts", roller=1,dtstartfrac=0.7,forecast_ds=fcst_in)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.