despecified_aggregates | R Documentation |
PSUT matrices often have row and column names that been specified to contain more information than simply the industry or product. Examples include "Resources [of Coal]" and "Automobiles -> RoP". It is sometimes helpful to despecify and aggregate these rows and columns so that all "Resources" are summed together, all "Automobiles" are summed together, etc. This function performs that aggregation.
despecified_aggregates(
.sut_data = NULL,
piece_to_keep = "noun",
R = Recca::psut_cols$R,
U = Recca::psut_cols$U,
U_feed = Recca::psut_cols$U_feed,
U_eiou = Recca::psut_cols$U_eiou,
r_eiou = Recca::psut_cols$r_eiou,
V = Recca::psut_cols$V,
Y = Recca::psut_cols$Y,
S_units = Recca::psut_cols$S_units,
inf_notation = TRUE,
notation = list(RCLabels::notations_list),
margin = list(c(1, 2)),
choose_most_specific = TRUE,
prepositions = list(RCLabels::prepositions_list),
R_aggregated_colname = paste0(Recca::psut_cols$R, aggregated_suffix),
U_aggregated_colname = paste0(Recca::psut_cols$U, aggregated_suffix),
U_feed_aggregated_colname = paste0(Recca::psut_cols$U_feed, aggregated_suffix),
U_eiou_aggregated_colname = paste0(Recca::psut_cols$U_eiou, aggregated_suffix),
r_eiou_aggregated_colname = paste0(Recca::psut_cols$r_eiou, aggregated_suffix),
V_aggregated_colname = paste0(Recca::psut_cols$V, aggregated_suffix),
Y_aggregated_colname = paste0(Recca::psut_cols$Y, aggregated_suffix),
S_units_aggregated_colname = paste0(Recca::psut_cols$S_units, aggregated_suffix),
aggregated_suffix = Recca::aggregate_cols$aggregated_suffix
)
.sut_data |
A data frame of matrices to be despecified and aggregated. |
piece_to_keep |
The piece of the label to retain before aggregation. Default is "noun". |
R , U , U_feed , U_eiou , r_eiou , V , Y , S_units |
Matrices or names of columns in |
inf_notation |
A boolean that tells whether to infer the row and column label notation.
Default is |
notation |
The notation for row and column labels.
Default is |
margin |
The margins over which aggregation is performed.
Default is |
choose_most_specific |
A boolean that tells whether to choose the most-specific
notation if 2 or more notations match.
Default is |
prepositions |
A list of prepositions that could appear in row and column names.
Default is |
R_aggregated_colname , U_aggregated_colname , U_feed_aggregated_colname , U_eiou_aggregated_colname , r_eiou_aggregated_colname , V_aggregated_colname , Y_aggregated_colname , S_units_aggregated_colname |
Names of aggregated matrices or columns. |
aggregated_suffix |
A string suffix used to form the names for aggregated matrices. Default is "_aggregated". |
By default, the aggregation is made to the nouns of row and column names
as defined by the RCLabels
package.
Which piece is to be aggregated is given in the piece_to_keep
argument.
Internally, this function uses matsbyname::aggregate_pieces_byname()
to do the heavy lifting.
A modified version of .sut_data
where rows and columns of matrices
have been aggregated to their despecified parts.
UKEnergy2000mats %>%
tidyr::pivot_wider(names_from = matrix.name, values_from = matrix) %>%
despecified_aggregates()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.