Check validity of a final-to-useful allocation table
check_fu_allocation_data.Rd
When analysts fill final-to-useful allocation templates created with
fu_allocation_template()
, some errors are likely.
This function checks for typical errors and
emits helpful error messages that point the analyst to the location of the problem.
Usage
check_fu_allocation_data(
.fu_allocation_table,
country = IEATools::iea_cols$country,
year = IEATools::iea_cols$year,
flow_aggregation_point = IEATools::iea_cols$flow_aggregation_point,
machine = IEATools::template_cols$machine,
ef_product = IEATools::template_cols$ef_product,
eu_product = IEATools::template_cols$eu_product,
destination = IEATools::template_cols$destination,
quantity = IEATools::template_cols$quantity,
.values = IEATools::template_cols$.values,
non_energy_machine = "Non-energy"
)
Arguments
- .fu_allocation_table
The final-to-useful allocation table you want to check.
- country, year, flow_aggregation_point
See
IEATools::iea_cols
.- machine, ef_product, eu_product, destination, quantity, .values
- non_energy_machine
The string that identifies a Non-energy machine. Default is "Non-energy".
Details
This function checks for two typical errors.
First, this function checks that
ef_product
andeu_product
are identical whenmachine
isnon_energy_machine
.Second, this function checks that
machine
andeu_product
are present when.values
is notNA
. This check is performed on a tidy version of.fu_allocation_table
.
Examples
load_fu_allocation_data() %>%
check_fu_allocation_data()
#> [1] TRUE