Aggregate PSUT matrices by row and column groups
grouped_aggregations.Rd
Aggregating to groups of rows or columns can be accomplished by an aggregation_map
.
Internally, this function calls Recca::grou_aggregates()
, so
arguments aggregation_map
, margin
, and pattern_type
control its behavior.
Usage
grouped_aggregations(
.psut_data,
countries,
years,
aggregation_map,
margin = list(c(1, 2)),
pattern_type = "exact",
R = Recca::psut_cols$R,
U = Recca::psut_cols$U,
V = Recca::psut_cols$V,
Y = Recca::psut_cols$Y,
r_eiou = Recca::psut_cols$r_eiou,
U_eiou = Recca::psut_cols$U_eiou,
U_feed = Recca::psut_cols$U_feed,
S_units = Recca::psut_cols$S_units,
R_aggregated_colname = paste0(Recca::psut_cols$R, aggregated_suffix),
U_aggregated_colname = paste0(Recca::psut_cols$U, aggregated_suffix),
V_aggregated_colname = paste0(Recca::psut_cols$V, aggregated_suffix),
Y_aggregated_colname = paste0(Recca::psut_cols$Y, aggregated_suffix),
r_eiou_aggregated_colname = paste0(Recca::psut_cols$r_eiou, aggregated_suffix),
U_eiou_aggregated_colname = paste0(Recca::psut_cols$U_eiou, aggregated_suffix),
U_feed_aggregated_colname = paste0(Recca::psut_cols$U_feed, aggregated_suffix),
S_units_aggregated_colname = paste0(Recca::psut_cols$S_units, aggregated_suffix),
aggregated_suffix = Recca::aggregate_cols$aggregated_suffix
)
Arguments
- .psut_data
A data frame of PSUT matrices.
- countries
The countries to be analyzed.
- years
The years to be analyzed.
- aggregation_map
A named list of rows or columns to be aggregated (or
NULL
).- margin
1
,2
, orc(1, 2)
for row aggregation, column aggregation, or both. As a string,margin
can be a row or column type. Default isc(1, 2)
.- pattern_type
See
RCLabels::make_or_pattern()
. Default is "exact".- R, U, V, Y, r_eiou, U_eiou, U_feed, S_units
The names of input columns in
.psut_data
. Default values are taken fromRecca::psut_cols
.- R_aggregated_colname, U_aggregated_colname, V_aggregated_colname, Y_aggregated_colname, r_eiou_aggregated_colname, U_eiou_aggregated_colname, U_feed_aggregated_colname, S_units_aggregated_colname
The names of output aggregated columns.
- aggregated_suffix
The suffix for columns of aggregated matrices. Default is
Recca::aggregate_cols$aggregated_suffix
.