calc_bilateral_trade_df_gma.Rd
The function calculates the bilateral trade data associated to a .tidy_iea_df
, using the Global Market Assumption.
calc_bilateral_trade_df_gma(
.tidy_iea_df,
year = IEATools::iea_cols$year,
method = IEATools::iea_cols$method,
energy_type = IEATools::iea_cols$energy_type,
last_stage = IEATools::iea_cols$last_stage,
country = IEATools::iea_cols$country,
provenience = "Provenience",
matnames = "matnames",
Share_Exports_By_Product = "Share_Exports_By_Product"
)
The .tidy_iea_df
for which the associated bilateral trade data, using the Global Market Assumption, needs to be calculated.
See IEATools::iea_cols
.
The name of the column in the output data frame that receives the flow,
i.e. the importing country for a given flow.
Default is IEATools::iea_cols$country
.
The name of the column in the output data frame that originates the flow, i.e. the exporting country for a given flow. Default is "Provenience".
The column name for matrices names.
Default is IEATools::mat_meta_cols$matnames
.
The name of the column containing the share of exports by country, for each product. Default is "Share_Exports_By_Product".
A data frame that represents the bilateral trade data associated to the input .tidy_iea_df
,
using the Global Market Assumption.
A column specifying matrix name for each flows needs to be added before, most likely using the IEATools::add_psut_matnames()
function.
tidy_AB_data %>%
IEATools::add_psut_matnames() %>%
calc_bilateral_trade_df_gma() %>%
print()
#> # A tibble: 8 × 8
#> Provenience Country Method Energy.type Last.stage Year Product
#> <chr> <chr> <chr> <chr> <chr> <dbl> <chr>
#> 1 A A PCM E Final 2018 Coking coal
#> 2 A B PCM E Final 2018 Coking coal
#> 3 A A PCM E Final 2018 Crude oil
#> 4 A B PCM E Final 2018 Crude oil
#> 5 A A PCM E Final 2018 Natural gas
#> 6 A B PCM E Final 2018 Natural gas
#> 7 B A PCM E Final 2018 Coke oven coke
#> 8 B B PCM E Final 2018 Coke oven coke
#> # ℹ 1 more variable: Share_Exports_By_Product <dbl>