calc_share_global_production_by_product: Calculates for each product the share of global production by...

View source: R/transform_helpers.R

calc_share_global_production_by_productR Documentation

Calculates for each product the share of global production by country

Description

This function calculates for each product the share of global production by country.

Usage

calc_share_global_production_by_product(
  .tidy_iea_df,
  country = IEATools::iea_cols$country,
  year = IEATools::iea_cols$year,
  method = IEATools::iea_cols$method,
  energy_type = IEATools::iea_cols$energy_type,
  last_stage = IEATools::iea_cols$last_stage,
  ledger_side = IEATools::iea_cols$ledger_side,
  flow_aggregation_point = IEATools::iea_cols$flow_aggregation_point,
  flow = IEATools::iea_cols$flow,
  product = IEATools::iea_cols$product,
  e_dot = IEATools::iea_cols$e_dot,
  unit = IEATools::iea_cols$unit,
  matnames = IEATools::mat_meta_cols$matnames,
  National_Production_By_Product = "National_Production_By_Product",
  Global_Production_By_Product = "Global_Production_By_Product",
  Share_Global_Production_By_Product = "Share_Global_Production_By_Product",
  Producing_Country = "Producing_Country"
)

Arguments

.tidy_iea_df

The .tidy_iea_df for which the shares of global production by country, for each product, need to be calculated.

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

See IEATools::iea_cols.

matnames

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

National_Production_By_Product

The name of a temporary column that contains the national production by product.

Global_Production_By_Product

The name of a temporary column that contains the global production by product.

Share_Global_Production_By_Product

The name of the column containing the share of global production.

Producing_Country

The name of the column containing the name of the producing country.

Details

The calculation is done using sequentially the functions:

  • calc_global_production_by_product();

  • calc_national_production_by_product(); and then calculating shares.

Note: the function needs to have a column indicating matrix names added first, most likely using the IEATools::add_psut_matnames() function.

Value

A data frame representing the share of global production for each product, by country.

Examples

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

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