The function calculates the national production by product. Included flows are flows belonging to either the R or V matrices, excluding import flows.

calc_national_production_by_product(
  .tidy_iea_df,
  ledger_side = IEATools::iea_cols$ledger_side,
  flow_aggregation_point = IEATools::iea_cols$flow_aggregation_point,
  flow = IEATools::iea_cols$flow,
  e_dot = IEATools::iea_cols$e_dot,
  matnames = IEATools::mat_meta_cols$matnames,
  V_matrix = IEATools::psut_cols$V,
  R_matrix = IEATools::psut_cols$R,
  imports = IEATools::interface_industries$imports,
  National_Production_By_Product = "National_Production_By_Product"
)

Arguments

.tidy_iea_df

The .tidy_iea_df for which national production by product needs to be calculated.

ledger_side, flow_aggregation_point, flow, e_dot

See IEATools::iea_cols.

matnames

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

V_matrix

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

R_matrix

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

imports

The name of imports flows in the .tidy_iea_df. Default is IEATools::interface_industries$imports.

National_Production_By_Product

The name of the column containing national production for each product, by country. Default is "National_Production_By_Product".

Value

A data frame that returns the national production by product.

Details

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_national_production_by_product() %>%
print()
#> # A tibble: 18 × 8
#> # Groups:   Country, Method, Energy.type, Last.stage, Year, Product [18]
#>    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 A       PCM    E           Final       2018 Natural gas                 ktoe 
#> 12 A       PCM    E           Final       2018 Natural gas [from Resource… ktoe 
#> 13 B       PCM    E           Final       2018 Blast furnace gas           ktoe 
#> 14 B       PCM    E           Final       2018 Coke oven coke              ktoe 
#> 15 B       PCM    E           Final       2018 Electricity                 ktoe 
#> 16 B       PCM    E           Final       2018 Heat                        ktoe 
#> 17 B       PCM    E           Final       2018 Kerosene type jet fuel exc… ktoe 
#> 18 B       PCM    E           Final       2018 Motor gasoline excl. biofu… ktoe 
#> # ℹ 1 more variable: National_Production_By_Product <dbl>