View source: R/temporal_aggregation.R
aggregate_index | R Documentation |
experimental
aggregate_index(.data, .window, ..., .offset = "end", .bin_size = NULL)
This feature is very experimental. It currently allows for temporal aggregation of daily data as a proof of concept.
The aggregation .window
can be specified in several ways:
A character string, containing one of "day", "week", "month", "quarter" or "year". This can optionally be preceded by a (positive or negative) integer and a space, or followed by "s".
A number, taken to be in days.
A difftime
object.
library(tsibble)
pedestrian %>%
# Currently only supports daily data
index_by(Date) %>%
dplyr::summarise(Count = sum(Count)) %>%
# Compute weekly aggregates
fabletools:::aggregate_index("1 week", Count = sum(Count))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.