specify_MR_Y_U_bta: Specifies Multi-Regional final demand (Y) and use (U)...

View source: R/transforms_to_bta.R

specify_MR_Y_U_btaR Documentation

Specifies Multi-Regional final demand (Y) and use (U) matrices with Bilateral Trade Assumption

Description

This function specifies flows belonging to the Y, U_feed, U_eiou, and B (only for those flows akin to final demand) matrices, according to the Bilateral Trade Assumption. See details for more explanations.

Usage

specify_MR_Y_U_bta(
  .tidy_iea_df,
  bilateral_trade_df = calc_bilateral_trade_df_gma(.tidy_iea_df),
  flow = IEATools::iea_cols$flow,
  product = IEATools::iea_cols$product,
  year = IEATools::iea_cols$year,
  method = IEATools::iea_cols$method,
  energy_type = IEATools::iea_cols$energy_type,
  last_stage = IEATools::iea_cols$last_stage,
  e_dot = IEATools::iea_cols$e_dot,
  country = IEATools::iea_cols$country,
  unit = IEATools::iea_cols$unit,
  aggregate_country_name = "World",
  provenience = "Provenience",
  origin = "Origin",
  domestic = "Domestic",
  imported = "Imported",
  Share_Exports_By_Product = "Share_Exports_By_Product",
  Producing_Country = "Producing_Country",
  Share_Global_Production_By_Product = "Share_Global_Production_By_Product"
)

Arguments

.tidy_iea_df

The .tidy_iea_df from which the Multi-Regional Y and U matrices needs to be created.

bilateral_trade_df

The bilateral trade data to be used to specify Y and U matrices flows. Default is bilateral trade data corresponding to the Global Market Assumption, calculated as calc_bilateral_trade_df_gma(.tidy_iea_df).

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

See IEATools::iea_cols.

aggregate_country_name

The name of the new region that gathers all flows of the .tidy_iea_df. Default is "World".

provenience

The name of the temporary column that specifies the origin of a given flow. Default is "Provenience".

origin

The name of the column specifying whether a given flow comes refers to a domestic or imported product. Default is "Origin".

domestic

The string that indicates that the product is of domestic origin in the new origin column. Default is "Domestic".

imported

The string that indicates that the product is of imported origin in the new origin column. Default is "Imported".

Share_Exports_By_Product

The name of a temporary column that contains the share of global exports by country, for each product. Default is "Share_Exports_By_Product".

Producing_Country

The name of a temporary column that contains the provenance country for a given flow, i.e. the exporting country of a given flow. Default is "Producing_Country".

Share_Global_Production_By_Product

The name if a temporary column that contains the share of global product by country, for each product. Default is "Share_Global_Production_By_Product".

Details

First, each flow is separated into a flow of domestic product and imported product, using the specify_imported_products() function. Then, the bilateral trade data passed as bilateral_trade_df argument, is used to specify the flows that are imported.

Only flows belonging to the Y, U_feed, U_eiou, and B matrices are returned. Note that matrices names need to be added first, most likely using the IEATools::add_psut_matnames() function.

Value

A .tidy_iea_df with flows corresponding to the Y, U_feed, U_eiou, and B matrices are specified.

Examples

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

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