Makes a frequency change of this series.
Usage
aggregate(
s,
nfreq = 1,
conversion = c("Sum", "Average", "First", "Last", "Min", "Max"),
complete = TRUE
)
Arguments
- s
the input time series.
- nfreq
the new frequency. Must be la divisor of the frequency of
s
.- conversion
Aggregation mode: sum (
"Sum"
), average ("Average"
), first observation ("First"
), last observation ("Last"
), minimum ("Min"
), maximum ("Max"
).- complete
Boolean indicating if the observation for a given period in the new series is set missing if some data in the original series are missing.
Examples
s <- ABS$X0.2.09.10.M
# Annual sum
aggregate(s, nfreq = 1, conversion = "Sum") # first and last years removed
#> Time Series:
#> Start = 1983
#> End = 2016
#> Frequency = 1
#> [1] 6132.6 6688.3 7614.5 8136.0 8692.8 9266.3 9592.9 9875.2 10051.2
#> [10] 10497.0 10705.9 11105.1 11442.6 11632.3 11813.7 12232.4 12719.2 13271.0
#> [19] 13814.6 14569.2 15539.8 16432.0 16625.9 16930.4 17811.7 18357.7 18801.6
#> [28] 18579.0 18172.0 18326.8 18171.6 18160.9 18727.3 18811.1
aggregate(s, nfreq = 1, conversion = "Sum", complete = FALSE)
#> Time Series:
#> Start = 1982
#> End = 2017
#> Frequency = 1
#> [1] 4634.0 6132.6 6688.3 7614.5 8136.0 8692.8 9266.3 9592.9 9875.2
#> [10] 10051.2 10497.0 10705.9 11105.1 11442.6 11632.3 11813.7 12232.4 12719.2
#> [19] 13271.0 13814.6 14569.2 15539.8 16432.0 16625.9 16930.4 17811.7 18357.7
#> [28] 18801.6 18579.0 18172.0 18326.8 18171.6 18160.9 18727.3 18811.1 11172.0
# Quarterly mean
aggregate(s, nfreq = 4, conversion = "Average")
#> Qtr1 Qtr2 Qtr3 Qtr4
#> 1982 468.8333 454.2000 621.6333
#> 1983 409.7667 492.1333 469.7333 672.5667
#> 1984 437.9667 528.5333 523.2000 739.7333
#> 1985 498.2000 616.6000 582.8000 840.5667
#> 1986 532.0333 633.1000 635.4000 911.4667
#> 1987 575.6667 686.2000 664.9333 970.8000
#> 1988 620.0667 726.1667 685.9000 1056.6333
#> 1989 634.1667 749.5667 732.2667 1081.6333
#> 1990 663.7333 797.3333 736.9333 1093.7333
#> 1991 672.6333 774.4333 768.8000 1134.5333
#> 1992 702.4667 845.3333 777.2000 1174.0000
#> 1993 719.7333 878.1333 781.6333 1189.1333
#> 1994 743.8667 884.1000 822.9000 1250.8333
#> 1995 748.7000 913.3333 870.4333 1281.7333
#> 1996 794.0667 922.2000 876.8667 1284.3000
#> 1997 808.7333 891.3333 915.4000 1322.4333
#> 1998 818.8000 929.9000 950.5333 1378.2333
#> 1999 861.2000 952.9333 985.4333 1440.1667
#> 2000 875.0000 1080.8333 974.3667 1493.4667
#> 2001 934.6667 1062.5333 1025.5667 1582.1000
#> 2002 971.0667 1136.4000 1067.2333 1681.7000
#> 2003 1030.8333 1232.4667 1160.4667 1756.1667
#> 2004 1101.3667 1313.8333 1263.5333 1798.6000
#> 2005 1194.8000 1290.7000 1259.5333 1796.9333
#> 2006 1145.3000 1348.4000 1290.1000 1859.6667
#> 2007 1215.3000 1386.4000 1377.0333 1958.5000
#> 2008 1296.6667 1406.4333 1411.3333 2004.8000
#> 2009 1298.1667 1509.6667 1437.3667 2022.0000
#> 2010 1320.3000 1456.1000 1442.3333 1974.2667
#> 2011 1283.9000 1451.1333 1390.5667 1931.7333
#> 2012 1281.1000 1488.1667 1383.4000 1956.2667
#> 2013 1302.7667 1439.4667 1362.4000 1952.5667
#> 2014 1269.7000 1438.7667 1370.7333 1974.4333
#> 2015 1297.4000 1450.6000 1424.3000 2070.1333
#> 2016 1375.5000 1498.9333 1385.2333 2010.7000
#> 2017 1297.0667 1510.7333