calc_share_exports_by_product: Calculates the share of exports for each product, by country

View source: R/transform_helpers.R

calc_share_exports_by_productR Documentation

Calculates the share of exports for each product, by country

Description

This function calculates the share of exports for each product, by country.

Usage

calc_share_exports_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,
  ledger_side = IEATools::iea_cols$ledger_side,
  flow_aggregation_point = IEATools::iea_cols$flow_aggregation_point,
  product = IEATools::iea_cols$product,
  e_dot = IEATools::iea_cols$e_dot,
  unit = IEATools::iea_cols$unit,
  exports = IEATools::interface_industries$exports,
  matnames = "matnames",
  provenience = "Provenience",
  Global_Exports_By_Product = "Global_Exports_By_Product",
  Share_Exports_By_Product = "Share_Exports_By_Product"
)

Arguments

.tidy_iea_df

The .tidy_iea_df for which the shares of exports for each product need to be calculated.

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

See IEATools::iea_cols.

exports

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

matnames

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

provenience

The name of the column reporting the country of provenience, i.e. the exporting country.

Global_Exports_By_Product

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

Share_Exports_By_Product

The name of the column that contains the share of exports for each product, by country.

Details

The function calls first the calc_global_exports() function.

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 that reports the share of exports for each product, by country.

Examples

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

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