Aggregate.purse {COINr}R Documentation

Aggregate indicators


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


## S3 method for class 'purse'
  f_ag = NULL,
  w = NULL,
  f_ag_para = NULL,
  dat_thresh = NULL,
  write_to = NULL,



A purse-class object


The name of the data set to apply the function to, which should be accessible in .$Data.


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 n-1, where n is the number of levels in the index structure. In this latter case, a different aggregation function may be used for each level in the index: the first in the vector will be used to aggregate from Level 1 to Level 2, the second from Level 2 to Level 3, and so on.


An optional data frame of weights. If f_ag does not require or accept weights, set to "none".


Optional parameters to pass to f_ag, other than x and w. As with f_ag, this can specified to have different parameters for each aggregation level by specifying as a nested list of length n-1.


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 NA. Data availability, for a row x_row is defined as sum(!, i.e. the fraction of non-NA values.


If specified, writes the aggregated data to .$Data[[write_to]]. Default write_to = "Aggregated".


arguments passed to or from other methods.


An updated purse with new treated data sets added at .$Data[[write_to]] in each coin.


# 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")

[Package COINr version 1.1.7 Index]