This function relocates exports to the balancing matrix B. The Balancing matrix is akin to an additional final demand matrix.

exports_to_balancing(
  .tidy_iea_df,
  flow = IEATools::iea_cols$flow,
  matnames = IEATools::mat_meta_cols$matnames,
  ledger_side = IEATools::iea_cols$ledger_side,
  e_dot = IEATools::iea_cols$e_dot,
  exports = IEATools::interface_industries$exports,
  balancing_matrix = "B"
)

Arguments

.tidy_iea_df

The .tidy_iea_df for which export flows need to be relocated in the Balancing matrix.

flow

See IEATools::iea_cols.

matnames

The column name of the column containing matrices names. Default is IEATools::mat_meta_cols$matnames.

ledger_side

See IEATools::iea_cols.

e_dot

See IEATools::iea_cols.

exports

The string that identifies export flows. Default is IEATools::interface_industries$exports.

balancing_matrix

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

Value

A .tidy_iea_df with Stock changes flows relocated in the Balancing matrix.

Details

See the Balancing matrix vignette for more information. Note: one needs to add the column containing matrices names first, most likely using the IEATools::add_psut_matnames() function.

Examples

tidy_AB_data %>%
IEATools::add_psut_matnames() %>%
dplyr::filter(stringr::str_detect(Flow, "Exports")) %>%
exports_to_balancing() %>%
print()
#> # A tibble: 4 × 12
#>   Country Method Energy.type Last.stage  Year Ledger.side Flow.aggregation.point
#>   <chr>   <chr>  <chr>       <chr>      <dbl> <chr>       <chr>                 
#> 1 A       PCM    E           Final       2018 balancing   Total primary energy …
#> 2 A       PCM    E           Final       2018 balancing   Total primary energy …
#> 3 A       PCM    E           Final       2018 balancing   Total primary energy …
#> 4 B       PCM    E           Final       2018 balancing   Total primary energy …
#> # ℹ 5 more variables: Flow <chr>, Product <chr>, Unit <chr>, E.dot <dbl>,
#> #   matnames <chr>