calc_share_imports_by_products: Calculates the shares of imports to total consumption by...

View source: R/transform_helpers.R

calc_share_imports_by_productsR Documentation

Calculates the shares of imports to total consumption by product, for each country and year.

Description

The function calculates the shares of imports to total consumption by product, for each country and year.

Usage

calc_share_imports_by_products(
  .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,
  ledger_side = IEATools::iea_cols$ledger_side,
  flow_aggregation_point = IEATools::iea_cols$flow_aggregation_point,
  year = IEATools::iea_cols$year,
  product = IEATools::iea_cols$product,
  unit = IEATools::iea_cols$unit,
  e_dot = IEATools::iea_cols$e_dot,
  imports = IEATools::interface_industries$imports,
  matnames = "matnames",
  Total_Consumption_By_Product = "Total_Consumption_By_Product",
  Share_Imports_By_Product = "Share_Imports_By_Product"
)

Arguments

.tidy_iea_df

The .tidy_iea_df for which the shares of imports over final consumption, by product, need to be calculated.

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

See IEATools::iea_cols.

imports

The name of the column containing the quantity (in energy terms) of imported products. Default is IEATools::interface_industries$imports.

matnames

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

Total_Consumption_By_Product

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

Share_Imports_By_Product

The name of the new column returning the share of imports over total consumption.

Details

Total consumption is calculated using the calc_total_consumption_by_product() 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 returning the share of imports over final consumption, for each product.

Examples

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

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