Learn R Programming

tidyindex (version 0.1.0)

temporal_aggregate: The temporal processing module

Description

The temporal processing module is used to aggregate data along the temporal dimension. Current available aggregation recipe includes temporal_rolling_window.

Usage

temporal_aggregate(data, ...)

temporal_rolling_window( var, scale, .before = 0L, .step = 1L, .complete = TRUE, rm.na = TRUE, ... )

Value

an index table object

Arguments

data

an index table object, see [tidyindex::init()]

...

an temporal processing object of class temporal_agg

var

the variable to aggregate

scale

numeric, the scale (window) of the aggregation

.before, .step, .complete

see slide_dbl

rm.na

logical, whether to remove the first few rows with NAs

Examples

Run this code
tenterfield |>
  init(time = ym) |>
  temporal_aggregate(.agg = temporal_rolling_window(prcp, scale = 12))

# multiple ids (groups), and multiple scales
queensland |>
  dplyr::filter(id %in% c("ASN00029038", "ASN00029127")) |>
  init(id = id, time = ym) |>
  temporal_aggregate(temporal_rolling_window(prcp, scale = c(12, 24)))

Run the code above in your browser using DataLab