View source: R/energy_balance.R
verify_IEATable_energy_balance | R Documentation |
Energy balances are confirmed (within tol
) for every combination of
grouping variables in .ieatidydata
.
verify_IEATable_energy_balance(
.ieatidydata,
LedgerSide = IEATools::iea_cols$ledger_side,
energy = IEATools::iea_cols$e_dot,
supply = "Supply",
consumption = "Consumption",
err = ".err",
tol = 1e-06
)
.ieatidydata |
an IEA-style data frame containing grouping columns
(typically |
LedgerSide |
the name of the column in |
energy |
the name of the column in |
supply |
the identifier for supply data in the |
consumption |
the identifier for consumption data in the |
err |
the name of the error column in the output. Default is " |
tol |
the maximum amount by which Supply and Consumption can be out of balance |
Be sure to group .ieatidydata
prior to calling this function,
as shown in the example.
If energy is in balance for every group, a data frame with additional column err
is returned.
If energy balance is not observed for one or more of the groups,
a warning is emitted.
a data frame containing with grouping variables and
an additional column whose name is the value of err
.
The err
column should be 0.
library(dplyr)
UKEnergy2000tidy %>%
filter(LastStage %in% c("Final", "Useful")) %>%
group_by(Country, Year, EnergyType, LastStage) %>%
verify_IEATable_energy_balance(energy = IEATools::iea_cols$e_dot)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.