View source: R/lmForc_subset.R
subset_identical | R Documentation |
Function for subsetting all forecasts in a list of Forecast objects to overlapping origin or future values.
subset_identical(forcs, slot)
forcs |
List of Forecast objects. |
slot |
Character representing whether the list of Forecasts will be subset to identical origin or future values. Must be either "origin" or "future". |
List of subsetted Forecast objects with identical future or origin values.
forc1_1h <- Forecast(
origin = as.Date(c("2010-02-17", "2010-05-14", "2010-07-22", "2010-12-05", "2011-03-10")),
future = as.Date(c("2010-06-30", "2010-09-30", "2010-12-31", "2011-03-31", "2011-06-30")),
forecast = c(4.27, 3.36, 4.78, 5.45, 5.12),
realized = c(4.96, 4.17, 4.26, 4.99, 5.38),
h_ahead = 1
)
forc2_1h <- Forecast(
origin = as.Date(c("2010-02-17", "2010-05-14", "2010-07-22", "2010-12-22", "2011-03-27")),
future = as.Date(c("2010-06-30", "2010-09-30", "2010-12-31", "2011-03-31", "2011-06-30")),
forecast = c(4.01, 3.89, 3.31, 4.33, 4.61),
realized = c(4.96, 4.17, 4.26, 4.99, 5.38),
h_ahead = 1
)
forcs <- list(forc1_1h, forc2_1h)
subset_identical(forcs, slot = "origin")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.