This function calculates for each product the share of global production by country.

calc_share_global_production_by_product(
  .tidy_iea_df,
  country = IEATools::iea_cols$country,
  year = IEATools::iea_cols$year,
  method = IEATools::iea_cols$method,
  energy_type = IEATools::iea_cols$energy_type,
  last_stage = IEATools::iea_cols$last_stage,
  ledger_side = IEATools::iea_cols$ledger_side,
  flow_aggregation_point = IEATools::iea_cols$flow_aggregation_point,
  flow = IEATools::iea_cols$flow,
  product = IEATools::iea_cols$product,
  e_dot = IEATools::iea_cols$e_dot,
  unit = IEATools::iea_cols$unit,
  matnames = IEATools::mat_meta_cols$matnames,
  National_Production_By_Product = "National_Production_By_Product",
  Global_Production_By_Product = "Global_Production_By_Product",
  Share_Global_Production_By_Product = "Share_Global_Production_By_Product",
  Producing_Country = "Producing_Country"
)

Arguments

.tidy_iea_df

The .tidy_iea_df for which the shares of global production by country, for each product, need to be calculated.

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

See IEATools::iea_cols.

matnames

The column name for matrices names. Default is IEATools::mat_meta_cols$matnames.

National_Production_By_Product

The name of a temporary column that contains the national production by product.

Global_Production_By_Product

The name of a temporary column that contains the global production by product.

Share_Global_Production_By_Product

The name of the column containing the share of global production.

Producing_Country

The name of the column containing the name of the producing country.

Value

A data frame representing the share of global production for each product, by country.

Details

The calculation is done using sequentially the functions:

Note: the function needs to have a column indicating matrix names added first, most likely using the IEATools::add_psut_matnames() function.

Examples

tidy_AB_data %>%
IEATools::add_psut_matnames() %>%
calc_share_global_production_by_product() %>%
print()
#> # A tibble: 18 × 8
#> # Groups:   Method, Energy.type, Last.stage, Year, Product [12]
#>    Method Energy.type Last.stage  Year Product           Unit  Producing_Country
#>    <chr>  <chr>       <chr>      <dbl> <chr>             <chr> <chr>            
#>  1 PCM    E           Final       2018 Blast furnace gas ktoe  A                
#>  2 PCM    E           Final       2018 Blast furnace gas ktoe  B                
#>  3 PCM    E           Final       2018 Coke oven coke    ktoe  A                
#>  4 PCM    E           Final       2018 Coke oven coke    ktoe  B                
#>  5 PCM    E           Final       2018 Coking coal       ktoe  A                
#>  6 PCM    E           Final       2018 Coking coal [fro… ktoe  A                
#>  7 PCM    E           Final       2018 Crude oil         ktoe  A                
#>  8 PCM    E           Final       2018 Crude oil [from … ktoe  A                
#>  9 PCM    E           Final       2018 Electricity       ktoe  A                
#> 10 PCM    E           Final       2018 Electricity       ktoe  B                
#> 11 PCM    E           Final       2018 Heat              ktoe  A                
#> 12 PCM    E           Final       2018 Heat              ktoe  B                
#> 13 PCM    E           Final       2018 Kerosene type je… ktoe  A                
#> 14 PCM    E           Final       2018 Kerosene type je… ktoe  B                
#> 15 PCM    E           Final       2018 Motor gasoline e… ktoe  A                
#> 16 PCM    E           Final       2018 Motor gasoline e… ktoe  B                
#> 17 PCM    E           Final       2018 Natural gas       ktoe  A                
#> 18 PCM    E           Final       2018 Natural gas [fro… ktoe  A                
#> # ℹ 1 more variable: Share_Global_Production_By_Product <dbl>