calc_share_ff_use_by_product_by_group: Calculates the shares of each product use within each fossil...

View source: R/helpers_shares.R

calc_share_ff_use_by_product_by_groupR Documentation

Calculates the shares of each product use within each fossil fuel group

Description

This function calculates the shares of each product use within each fossil fuel group. The matrices containing energy use flows can be specified in the final_use_mats argument. By default, these matrices are U_EIOU and Y, and excludes energy flows used as feedstock. Exports and losses are also excluded from the total energy use. See details for more explanations.

Usage

calc_share_ff_use_by_product_by_group(
  .tidy_iea_df,
  include_non_energy_uses = FALSE,
  final_use_mats = c(IEATools::psut_cols$Y, IEATools::psut_cols$U_eiou),
  list_oil_products = IEATools::oil_and_oil_products,
  list_coal_products = IEATools::coal_and_coal_products,
  list_gas_products = IEATools::primary_gas_products,
  product.group = "Product.Group",
  total_product_use = "Total_Product_Use",
  total_group_use = "Total_Group_Use",
  non_energy_uses = "Non_Energy_Uses",
  share = "Share",
  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,
  unit = IEATools::iea_cols$unit,
  product = IEATools::iea_cols$product,
  boolean_non_energy_uses = "Boolean_Non_Energy_Uses",
  energy.stage = "Energy.stage",
  product_without_origin = "product_without_origin"
)

Arguments

.tidy_iea_df

The tidy iea data frame for which the shares of each product use within each fossil fuel group need to be calculated.

include_non_energy_uses

A boolean indicating whether non-energy uses should be included in the calculation. Default is FALSE.

final_use_mats

A list describing from which matrices should total final energy uses be calculated. Default is c(IEATools::psut_cols$Y, IEATools::psut_cols$U_eiou).

list_oil_products

A list containing the names of oil products. Default is IEATools::oil_and_oil_products.

list_coal_products

A list containing the names of coal products. Default is IEATools::coal_and_coal_products.

list_gas_products

A list containing the names of gas products. Default is IEATools::primary_gas_products.

product.group

The column name of the column defining the fossil fuel group. Default is "Product.Group".

total_product_use

Column name containing total energy use by product. Default is "Total_Product_Use".

total_group_use

Column name containing total energy use by product group. Default is "Total_Group_Use".

non_energy_uses

The name of the column stating whether non-energy use flows are included when computing the shares. Default is "Non_Energy_Uses".

share

The name of the column returning the shares of each product use within each fossil fuel group. Default is "Share".

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

See IEATools::iea_cols.

boolean_non_energy_uses

A temporary column name stating whether non-energy flows are included. Default is "Boolean_Non_Energy_Uses".

energy.stage

The column name of the column defining the energy stage. Default is "Energy.stage".

product_without_origin

The name of the column containing the product name without the product origin. Default is "product_without_origin"

Details

The function can work both on a single country Energy Conversion Chain of Domestic Technology Assumption type, or with a multi-regional Energy Conversion Chain for instance using the Global Market Assumption. The input data frame will have to be slightly adapted in this case (for an example see the tests related to the function), and the energy use by product will be returned as the pair (Origin_Country, Product). Non-energy use flows can be included or excluded from the calculations using the include_non_energy_uses boolean.

Value

A tidy data frame reporting the shares of each product use within each fossil fuel group.

Examples

ECCTools::tidy_AB_data %>% 
   IEATools::add_psut_matnames() %>% 
   ECCTools::transform_to_dta() %>% 
   calc_share_ff_use_by_product_by_group()

earamendia/EROITools documentation built on May 19, 2023, 10:30 a.m.