Balance IEA data
make_balanced.Rd
Balances the IEA data in a way that is amenable to drake subtargets.
Internally, this function uses IEATools::fix_tidy_iea_df_balances()
.
Grouping is done internal to this function using the value of grp_vars
.
Arguments
- .iea_data
A tidy IEA data frame.
- max_fix
The maximum allowable energy imbalance to fix. Default is
3
.- countries
The countries that should be balanced.
- 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
IEATools::sample_iea_data_path() %>%
IEATools::load_tidy_iea_df() %>%
make_balanced(countries = c("GHA", "ZAF")) %>%
is_balanced(countries = c("GHA", "ZAF"))
#> [1] TRUE