get_all_products_and_industries: Create lists of all products and industries

View source: R/utilities.R

get_all_products_and_industriesR Documentation

Create lists of all products and industries

Description

From matrices that describe an energy conversion chain (R, U, V, and Y), create a list of unique products (energy carriers) and industries (processing stages) in the energy conversion chain.

Usage

get_all_products_and_industries(
  .sutdata,
  piece = "all",
  inf_notation = TRUE,
  notation = list(RCLabels::notations_list),
  choose_most_specific = FALSE,
  prepositions = list(RCLabels::prepositions_list),
  R = IEATools::psut_cols$R,
  U = IEATools::psut_cols$U,
  V = IEATools::psut_cols$V,
  Y = IEATools::psut_cols$Y,
  products_col = Recca::prod_ind_names_colnames$product_names,
  industries_col = Recca::prod_ind_names_colnames$industry_names
)

Arguments

.sutdata

A data frame or list of matsindf matrices.

piece

A character string indicating which piece of the row or column names to retain, one of "all", "noun", "pps", "pref" or "suff", or a preposition, indicating which part of the row or column name is to be retained. Default is "all".

inf_notation

A boolean that tells whether to infer notation. Default is TRUE.

notation

The notation used for row and column labels. Default is list(RCLabels::notations_list). The default value is wrapped in a list, because RCLabels::notations_list is, itself, a list. See RCLabels.

choose_most_specific

A boolean that indicates whether the most-specific notation will be inferred when more than one of notation matches a row or column label and allow_multiple = FALSE. When FALSE, the first matching notation in notations is returned when allow_multiple = FALSE. Default is FALSE.

prepositions

Prepositions that can be used in the row and column label. Default is RCLabels::prepositions_list.

R, U, V, Y

The names of PSUT matrices. See IEAtools::psut_cols.

products_col

The name of the products column in the output list or data frame. Default is Recca::prod_ind_names_colnames$product_names.

industries_col

The name of the products column in the output list or data frame. Default is Recca::prod_ind_names_colnames$industry_names.

Details

This function is a matsindf::matsindf_apply() style function. It can accept a matsindf data frame in the .df argument and string for the R, U, V, and Y (as column names) in the arguments.

Value

.sutdata with two new columns containing the names of products and industries.

Examples

ecc <- UKEnergy2000mats %>%
  tidyr::pivot_wider(names_from = "matrix.name", values_from = "matrix") %>%
  get_all_products_and_industries()
# Show all unique product (energy carrier) names in the first row of ecc
ecc[[Recca::prod_ind_names_colnames$product_names]][[1]]
# Show all unique industry (processing stage) names
# in the fourth row of ecc.
ecc[[Recca::prod_ind_names_colnames$industry_names]][[4]]

MatthewHeun/Recca documentation built on Feb. 9, 2024, 6:18 p.m.