calc_share_exports_by_product.Rd
This function calculates the share of exports for each product, by country.
calc_share_exports_by_product(
.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,
year = IEATools::iea_cols$year,
ledger_side = IEATools::iea_cols$ledger_side,
flow_aggregation_point = IEATools::iea_cols$flow_aggregation_point,
product = IEATools::iea_cols$product,
e_dot = IEATools::iea_cols$e_dot,
unit = IEATools::iea_cols$unit,
exports = IEATools::interface_industries$exports,
matnames = "matnames",
provenience = "Provenience",
Global_Exports_By_Product = "Global_Exports_By_Product",
Share_Exports_By_Product = "Share_Exports_By_Product"
)
The .tidy_iea_df
for which the shares of exports for each product need to be calculated.
See IEATools::iea_cols
.
The name of exports flows in the .tidy_iea_df
.
Default is IEATools::interface_industries$exports
.
The column name for matrices names.
Default is IEATools::mat_meta_cols$matnames
.
The name of the column reporting the country of provenience, i.e. the exporting country.
The name of a temporary column that contains global exports by product.
The name of the column that contains the share of exports for each product, by country.
A data frame that reports the share of exports for each product, by country.
The function calls first the calc_global_exports()
function.
Note: the function needs to have a column indicating matrix names added first, most likely using the IEATools::add_psut_matnames()
function.
tidy_AB_data %>%
IEATools::add_psut_matnames() %>%
calc_share_exports_by_product() %>%
print()
#> # A tibble: 4 × 7
#> Provenience Method Energy.type Last.stage Year Product Share_Exports_By_Pro…¹
#> <chr> <chr> <chr> <chr> <dbl> <chr> <dbl>
#> 1 A PCM E Final 2018 Coking… 1
#> 2 A PCM E Final 2018 Crude … 1
#> 3 A PCM E Final 2018 Natura… 1
#> 4 B PCM E Final 2018 Coke o… 1
#> # ℹ abbreviated name: ¹Share_Exports_By_Product