The function calculates total consumption by product, for each country and year.

calc_total_consumption_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,
  product = IEATools::iea_cols$product,
  unit = IEATools::iea_cols$unit,
  e_dot = IEATools::iea_cols$e_dot,
  exports = IEATools::interface_industries$exports,
  matnames = "matnames",
  Y_matrix = "Y",
  U_feed_matrix = "U_feed",
  U_EIOU_matrix = "U_EIOU",
  balancing_matrix = "B",
  Total_Consumption_By_Product = "Total_Consumption_By_Product"
)

Arguments

.tidy_iea_df

The .tidy_iea_df to which the function should be applied.

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

See IEATools::iea_cols.

exports

The name of exports flows in the input data. Default is IEATools::interface_industries$exports.

matnames

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

Y_matrix

The name of the final demand Y matrix. Default is IEATools::psut_cols$Y.

U_feed_matrix

The name of the U_feed matrix. Default is IEATools::psut_cols$U_feed.

U_EIOU_matrix

The name of the U_eiou matrix. Default is IEATools::psut_cols$U_eiou.

balancing_matrix

The name of the Balancing matrix. Default is "B".

Total_Consumption_By_Product

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

Value

A data frame with total consumption by product, for each country and year.

Details

Flows included in the calculation of the total consumption by product are flows belonging to either the Y, U_feed, or U_eiou matrices. Flows belonging to the Y matrix but representing exports, are excluded. In addition, flows belonging to the Balancing matrix and akin to a final demand (i.e. E.dot > 0) are also included, provided they do not represent exports.

Examples

tidy_AB_data %>%
IEATools::add_psut_matnames() %>%
calc_total_consumption_by_product() %>%
print()
#> # A tibble: 21 × 8
#> # Groups:   Country, Method, Energy.type, Last.stage, Year, Product [21]
#>    Country Method Energy.type Last.stage  Year Product                     Unit 
#>    <chr>   <chr>  <chr>       <chr>      <dbl> <chr>                       <chr>
#>  1 A       PCM    E           Final       2018 Blast furnace gas           ktoe 
#>  2 A       PCM    E           Final       2018 Coke oven coke              ktoe 
#>  3 A       PCM    E           Final       2018 Coking coal                 ktoe 
#>  4 A       PCM    E           Final       2018 Coking coal [from Resource… ktoe 
#>  5 A       PCM    E           Final       2018 Crude oil                   ktoe 
#>  6 A       PCM    E           Final       2018 Crude oil [from Resources]  ktoe 
#>  7 A       PCM    E           Final       2018 Electricity                 ktoe 
#>  8 A       PCM    E           Final       2018 Heat                        ktoe 
#>  9 A       PCM    E           Final       2018 Kerosene type jet fuel exc… ktoe 
#> 10 A       PCM    E           Final       2018 Motor gasoline excl. biofu… ktoe 
#> # ℹ 11 more rows
#> # ℹ 1 more variable: Total_Consumption_By_Product <dbl>