transform_to_bta: Transforms to Bilateral Trade Assumption

View source: R/transforms_to_bta.R

transform_to_btaR Documentation

Transforms to Bilateral Trade Assumption

Description

This function transforms a .tidy_iea_df that contains the representation of the Energy Conversion Chain for multiple countries into a new tidy_iea_df that represents a Global Energy Conversion Chain, adopting the Bilateral Trade Assumption, using a bilateral trade data the particular trade data passed as bilateral_trade_df argument.

Usage

transform_to_bta(
  .tidy_iea_df,
  bilateral_trade_df = calc_bilateral_trade_df_gma(.tidy_iea_df)
)

Arguments

.tidy_iea_df

The .tidy_iea_df for which the Bilateral Trade Assumption flows need to be calculated according to a given bilateral_trade_df.

bilateral_trade_df

The bilateral trade data frame that will be used.

Details

This function runs sequentially the following functions:

  • specify_MR_R();

  • specify_MR_V();

  • specify_MR_Y_U_bta(); and then binds all rows obtained using dplyr::bind_rows().

Note 1: When no bilateral trade data is provided, the function calculates and uses the bilateral trade data associated with the Global Market Assumption.

Note 2: When bilateral trade data is provided only for an observation (Country, Product), then bilateral trade data obtained from the Global Market Assumption is used to fill the gap, for that particular (Country, Product) observation.

Note 3: running this function to transform to the Bilateral Trade Assumption only makes sense when the country coverage is global, or close to global (i.e. only countries consuming a very small fraction of global energy consumption, and only producing a very small fraction of global energy production, are missing).

Value

A .tidy_iea_df describing a Global Energy Conversion Chain, adopting a Bilateral Trade Perspective.

Examples

tidy_AB_data %>%
IEATools::add_psut_matnames() %>%
transform_to_bta() # Here, as we pass an empty bilateral trade matrix,
# the result will be equivalent to the Global Market Assumption.

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