y: Univariate or multivariate time series: a vector/matrix or a ts object.
agg_order: A numeric vector with the aggregation orders to consider.
tew: A string specifying the type of temporal aggregation. Options include: "sum" (simple summation, default), "avg" (average), "first" (first value of the period), and "last" (last value of the period).
align: A string or a vector specifying the alignment of y. Options include: "end" (end of the series, default), "start" (start of the series), an integer (or a vector of integers) indicating the starting period of the temporally aggregated series.
rm_na: If TRUE the missing values are removed.
Returns
A list of vectors or ts objects.
Examples
# Monthly time series (input vector)y <- ts(rnorm(24), start =2020, frequency =12)# Quarterly time seriesx1 <- aggts(y,3)# Monthly, quarterly and annual time seriesx2 <- aggts(y, c(1,3,12))# All temporally aggregated time seriesx3 <- aggts(y)# Ragged datay2 <- ts(rnorm(11), start = c(2020,3), frequency =4)# Annual time series: start in 2021x4 <- aggts(y2,4, align =3)# Semi-annual (start in 2nd semester of 2020) and annual (start in 2021) time seriesx5 <- aggts(y2, c(2,4), align = c(1,3))