Aggregate.purse {COINr} | R Documentation |
Aggregate indicators
Description
Aggregates indicators following the structure specified in iMeta
, for each coin inside the purse.
See Aggregate.coin()
, which is applied to each coin, for more information
Usage
## S3 method for class 'purse'
Aggregate(
x,
dset,
f_ag = NULL,
w = NULL,
f_ag_para = NULL,
dat_thresh = NULL,
write_to = NULL,
by_df = FALSE,
...
)
Arguments
x |
A purse-class object |
dset |
The name of the data set to apply the function to, which should be accessible in |
f_ag |
The name of an aggregation function, a string. This can either be a single string naming
a function to use for all aggregation levels, or else a character vector of function names of length |
w |
An optional data frame of weights. If |
f_ag_para |
Optional parameters to pass to |
dat_thresh |
An optional data availability threshold, specified as a number between 0 and 1. If a row
within an aggregation group has data availability lower than this threshold, the aggregated value for that row will be
|
write_to |
If specified, writes the aggregated data to |
by_df |
Controls whether to send a numeric vector to |
... |
arguments passed to or from other methods. |
Value
An updated purse with new treated data sets added at .$Data[[write_to]]
in each coin.
Examples
# build example purse up to normalised data set
purse <- build_example_purse(up_to = "Normalise", quietly = TRUE)
# aggregate using defaults
purse <- Aggregate(purse, dset = "Normalised")