cts
,
data.frame
,
rts
,
series
.
aggregate(x, ...) aggregate.default(x, ...)
bdFrame
. Currently, anything that is not a time
series is converted to a data frame and old style time series (with
a
tsp
attribute) are converted to class
rts
.
aggregate.data.frame
,
aggregate.rts
, and
aggregate.cts
for acceptable arguments.
bdFrame
containing the summary statistics.
Each method accepts a function for computing the summary
statistic. This function should always return a scalar.
Each method accepts different arguments, see
aggregate.data.frame
,
aggregate.rts
, or
aggregate.cts
for details.
# compute 50 year averages of sunspot numbers aggregate(sunspots, ndeltat=50, fun=mean) # Gives the following results: # [1] 53.96067 39.95750 45.09283 47.93400 # start deltat frequency # 1750 50 0.02 # Compute regional averages of demographic data aggregate(state.x77[,2:4], list(Region=state.region), FUN=mean) # Produces: # Region Income Illiteracy Life.Exp # Northeast Northeast 4570.222 1.000000 71.26444 # South South 4011.938 1.737500 69.70625 # NorthCentr NorthCentr 4611.083 0.700000 71.76667 # West West 4702.615 1.023077 71.23462