Tells whether IEA data are balanced
is_balanced.Rd
Performs the the energy balance check in a way that is amenable to drake subtargets.
Internally, this function uses IEATools::calc_tidy_iea_df_balances()
.
Grouping is doing internal to this function using the value of grp_vars
.
Arguments
- .iea_data
a tidy IEA data frame
- countries
the countries for which balancing should be checked as strings
- country
The name of the country column in
IEAData
. Default is Country.- grp_vars
the groups that should be checked. Default is
c(country, IEATools::iea_cols$method, IEATools::iea_cols$energy_type, IEATools::iea_cols$last_stage, IEATools::iea_cols$product)
.
Examples
# These data are not balanced, because they are raw.
IEATools::sample_iea_data_path() %>%
IEATools::load_tidy_iea_df() %>%
is_balanced(countries = "ZAF")
#> [1] FALSE