calc_total_consumption_by_product: Calculates total consumption by product, for each country and...

View source: R/transform_helpers.R

calc_total_consumption_by_productR Documentation

Calculates total consumption by product, for each country and year

Description

The function calculates total consumption by product, for each country and year.

Usage

calc_total_consumption_by_product(
  .tidy_iea_df,
  flow = IEATools::iea_cols$flow,
  country = IEATools::iea_cols$country,
  method = IEATools::iea_cols$method,
  energy_type = IEATools::iea_cols$energy_type,
  last_stage = IEATools::iea_cols$last_stage,
  year = IEATools::iea_cols$year,
  product = IEATools::iea_cols$product,
  unit = IEATools::iea_cols$unit,
  e_dot = IEATools::iea_cols$e_dot,
  exports = IEATools::interface_industries$exports,
  matnames = "matnames",
  Y_matrix = "Y",
  U_feed_matrix = "U_feed",
  U_EIOU_matrix = "U_EIOU",
  balancing_matrix = "B",
  Total_Consumption_By_Product = "Total_Consumption_By_Product"
)

Arguments

.tidy_iea_df

The .tidy_iea_df to which the function should be applied.

flow, country, method, energy_type, last_stage, year, product, unit, e_dot

See IEATools::iea_cols.

exports

The name of exports flows in the input data. Default is IEATools::interface_industries$exports.

matnames

The column name for matrices names. Default is IEATools::mat_meta_cols$matnames.

Y_matrix

The name of the final demand Y matrix. Default is IEATools::psut_cols$Y.

U_feed_matrix

The name of the U_feed matrix. Default is IEATools::psut_cols$U_feed.

U_EIOU_matrix

The name of the U_eiou matrix. Default is IEATools::psut_cols$U_eiou.

balancing_matrix

The name of the Balancing matrix. Default is "B".

Total_Consumption_By_Product

The name of the new column reporting total consumption by product.

Details

Flows included in the calculation of the total consumption by product are flows belonging to either the Y, U_feed, or U_eiou matrices. Flows belonging to the Y matrix but representing exports, are excluded. In addition, flows belonging to the Balancing matrix and akin to a final demand (i.e. E.dot > 0) are also included, provided they do not represent exports.

Value

A data frame with total consumption by product, for each country and year.

Examples

tidy_AB_data %>%
IEATools::add_psut_matnames() %>%
calc_total_consumption_by_product() %>%
print()

earamendia/ECCTools documentation built on May 12, 2023, 2:12 a.m.