aggregate_key | R Documentation |
Uses the structural specification given in .spec
to aggregate a time
series. A grouped structure is specified using grp1 * grp2
, and a nested
structure is specified via parent / child
. Aggregating the key structure is
commonly used with forecast reconciliation to produce coherent forecasts over
some hierarchy.
aggregate_key(.data, .spec, ...)
This function is experimental, and is subject to change in the future.
The way in which the measured variables are aggregated is specified in a
similar way to how [dplyr::summarise()]
is used.
reconcile()
, is_aggregated()
library(tsibble)
tourism %>%
aggregate_key(Purpose * (State / Region), Trips = sum(Trips))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.