stat_diffs_to_balancing.Rd
This function sends statistical differences flows to a balancing matrix Balancing. The Balancing matrix is akin to an additional final demand matrix, meaning that flows akin to final demand will be positive, while flows akin to supply will be negative.
stat_diffs_to_balancing(
.tidy_iea_df,
flow = IEATools::iea_cols$flow,
matnames = IEATools::mat_meta_cols$matnames,
e_dot = IEATools::iea_cols$e_dot,
stat_diffs = "Statistical differences",
ledger_side = IEATools::iea_cols$ledger_side,
balancing_matrix = "B"
)
The .tidy_iea_df
for which statistical differences flows need to be sent to the Balancing matrix.
See IEATools::iea_cols
.
The column name of the column having matrices names.
Default is IEATools::mat_meta_cols$matnames
.
The name of the statistical differences flows. Default is "Statistical differences".
The name of the Balancing matrix. Default is "B".
A .tidy_iea_df
for which statistical differences flows have been send to the Balancing matrix.
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.
tidy_AB_data %>%
tibble::add_row(
Country = "A",
Method = "PCM",
Energy.type = "Energy",
Last.stage = "Final",
Year = 2018,
Ledger.side = "Supply",
Flow.aggregation.point = "TFC compare",
Flow = "Statistical differences",
Product = "Crude oil",
Unit = "ktoe",
E.dot = 10
) %>%
IEATools::add_psut_matnames() %>%
stat_diffs_to_balancing() %>%
dplyr::filter(stringr::str_detect(Flow, "Statistical differences")) %>%
print()
#> # A tibble: 1 × 12
#> Country Method Energy.type Last.stage Year Ledger.side Flow.aggregation.point
#> <chr> <chr> <chr> <chr> <dbl> <chr> <chr>
#> 1 A PCM Energy Final 2018 balancing TFC compare
#> # ℹ 5 more variables: Flow <chr>, Product <chr>, Unit <chr>, E.dot <dbl>,
#> # matnames <chr>