Bundle several aggregation calculations together
pr_in_agg_pipeline.Rd
The efficiency pipeline calculates efficiencies for various despecifications, row aggregations, and column aggregations.
Usage
pr_in_agg_pipeline(
.psut_data,
product_agg_map,
industry_agg_map,
p_industries,
do_chops = FALSE,
pattern_type = "exact",
piece = "noun",
bracket_notation = RCLabels::bracket_notation,
arrow_notation = RCLabels::arrow_notation,
prepositions = RCLabels::prepositions_list,
method = "SVD",
tol_invert = .Machine$double.eps,
product_type = Recca::row_col_types$product_type,
industry_type = Recca::row_col_types$industry_type,
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,
.prime = "_prime",
country = Recca::psut_cols$country,
year = Recca::psut_cols$year,
R_aggregated_colname = paste0(R, aggregated_suffix),
U_aggregated_colname = paste0(U, aggregated_suffix),
U_feed_aggregated_colname = paste0(U_feed, aggregated_suffix),
U_eiou_aggregated_colname = paste0(U_eiou, aggregated_suffix),
r_eiou_aggregated_colname = paste0(r_eiou, aggregated_suffix),
V_aggregated_colname = paste0(V, aggregated_suffix),
Y_aggregated_colname = paste0(Y, aggregated_suffix),
S_units_aggregated_colname = paste0(S_units, aggregated_suffix),
aggregated_suffix = Recca::aggregate_cols$aggregated_suffix,
product_aggregation = PFUAggPipeline::aggregation_df_cols$product_aggregation,
industry_aggregation = PFUAggPipeline::aggregation_df_cols$industry_aggregation,
specified = PFUAggPipeline::aggregation_df_cols$specified,
despecified = PFUAggPipeline::aggregation_df_cols$despecified,
grouped = PFUAggPipeline::aggregation_df_cols$grouped,
chopped_mat = PFUAggPipeline::aggregation_df_cols$chopped_mat,
chopped_var = PFUAggPipeline::aggregation_df_cols$chopped_var,
Y_matname = Recca::psut_cols$Y,
R_matname = Recca::psut_cols$R,
product_sector = PFUAggPipeline::aggregation_df_cols$product_sector,
none = PFUAggPipeline::agg_metadata$none
)
Arguments
- .psut_data
PSUT matrices in wide-by-matrix format. This could be an entire data frame, a slice (row) of the data frame, or a group of the data frame.
- product_agg_map
The product aggregation map.
- industry_agg_map
The industry aggregation map.
- p_industries
A string vector of primary industries.
- do_chops
A boolean that tells whether to do the chopping of R and Y matrices.
- pattern_type
The matching type for row and column labels. Default is "exact".
- piece
The piece of row and column labels to be matched. Default is "noun".
- bracket_notation
A row and column notation. Default is
RCLabels::bracket_notation
.- arrow_notation
A row and column notation. Default is
RCLabels::arrow_notation
.- prepositions
Prepositions to be used in row and column labels. Default is
RCLabels::prepositions_list
.- method
The method for doing matrix inversion when chopping the R and Y matrices. Default is "SVD" for singular value decomposition.
- tol_invert
The tolerance for nearness to 0 in matrix inversion. Default is
.Machine$double.eps
.- product_type, industry_type
See
Recca::row_col_types
.- R, U, U_feed, U_eiou, r_eiou, V, Y, S_units, country, year
The names of input columns in
.psut_data
. Default values are fromRecca::psut_cols
.- .prime
The suffix for the columns containing chopped ECC matrices. Default is "_prime".
- 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. Defaults are the matrix names with
aggregated_suffix
appended.- aggregated_suffix
The suffix for aggregated column names. See
Recca::aggregate_cols
.- product_aggregation, industry_aggregation, specified, despecified, grouped, product_sector
- chopped_mat, chopped_var
Column names that indicate which matrix has been chopped, R or Y. Default values are from
PFUAggPipeline::aggregation_df_cols
.- Y_matname, R_matname
Matrix names for the
chopped_mat
andchopped_var
columns. Default values are fromRecca::psut_cols$R
andRecca::psut_cols$Y
.- none
The string to specify no aggregations. Default is
PFUAggPipeline::agg_metadata$none
.
Value
A data frame of efficiencies for the original, despecified, and grouped versions
of .psut_data
.
Details
This function is an attempt to streamline the calculation pipeline by eliminating the need to repeatedly re-load intermediate targets from disk. It bundles the work of previous targets to
despecify and aggregate both product and industry dimensions of PSUT matrices,
group and aggregate products,
group and aggregate industries,
group and aggregate both products and industries,
calculate primary-to-final efficiencies,
calculate primary-to-useful efficiencies, and
calculate final-to-useful efficiencies.