The function calculates the shares of imports to total consumption by product, for each country and year.

calc_share_imports_by_products(
  .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,
  ledger_side = IEATools::iea_cols$ledger_side,
  flow_aggregation_point = IEATools::iea_cols$flow_aggregation_point,
  year = IEATools::iea_cols$year,
  product = IEATools::iea_cols$product,
  unit = IEATools::iea_cols$unit,
  e_dot = IEATools::iea_cols$e_dot,
  imports = IEATools::interface_industries$imports,
  matnames = "matnames",
  Total_Consumption_By_Product = "Total_Consumption_By_Product",
  Share_Imports_By_Product = "Share_Imports_By_Product"
)

Arguments

.tidy_iea_df

The .tidy_iea_df for which the shares of imports over final consumption, by product, need to be calculated.

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

See IEATools::iea_cols.

imports

The name of the column containing the quantity (in energy terms) of imported products. Default is IEATools::interface_industries$imports.

matnames

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

Total_Consumption_By_Product

The name of the new column returning total consumption by product.

Share_Imports_By_Product

The name of the new column returning the share of imports over total consumption.

Value

A data frame returning the share of imports over final consumption, for each product.

Details

Total consumption is calculated using the calc_total_consumption_by_product() function.

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_imports_by_products() %>%
print()
#> # A tibble: 21 × 9
#> # Groups:   Country, Method, Energy.type, Last.stage, Year, Product [21]
#>    Country Method Energy.type Last.stage  Year Product    Total_Consumption_By…¹
#>    <chr>   <chr>  <chr>       <chr>      <dbl> <chr>                       <dbl>
#>  1 A       PCM    E           Final       2018 Blast fur…                    850
#>  2 A       PCM    E           Final       2018 Coke oven…                   1000
#>  3 A       PCM    E           Final       2018 Coking co…                   3000
#>  4 A       PCM    E           Final       2018 Coking co…                   5000
#>  5 A       PCM    E           Final       2018 Crude oil                    5000
#>  6 A       PCM    E           Final       2018 Crude oil…                   8500
#>  7 A       PCM    E           Final       2018 Electrici…                   3200
#>  8 A       PCM    E           Final       2018 Heat                          250
#>  9 A       PCM    E           Final       2018 Kerosene …                   1750
#> 10 A       PCM    E           Final       2018 Motor gas…                   2400
#> # ℹ 11 more rows
#> # ℹ abbreviated name: ¹​Total_Consumption_By_Product
#> # ℹ 2 more variables: Imports <dbl>, Share_Imports_By_Product <dbl>