Skip to contents

Analysts fill final-to-useful (FU) allocation tables in a human-readable format provided by fu_allocation_template() and write_fu_allocation_template(). The templates are not tidy. However, most code uses in IEATools requires tidy data frames. This function converts an FU allocation table with years in columns to a tidy data frame with years in a year column and C values in a .values column. Identifiers for the C values are in the quantity column.

Usage

tidy_fu_allocation_table(
  .fu_allocation_table,
  year = IEATools::iea_cols$year,
  e_dot = IEATools::iea_cols$e_dot,
  unit = IEATools::iea_cols$unit,
  e_dot_perc = IEATools::template_cols$e_dot_perc,
  quantity = IEATools::template_cols$quantity,
  maximum_values = IEATools::template_cols$maximum_values,
  .values = IEATools::template_cols$.values
)

Arguments

.fu_allocation_table

The final-to-useful allocation table to be tidied.

year, e_dot, unit

See IEATools::iea_cols.

e_dot_perc, quantity, maximum_values, .values

See IEATools::template_cols.

Value

A tidy version of .fu_allocation_table.

Details

If .fu_allocation_table is already tidy, it is returned unmodified.

Examples

load_fu_allocation_data() %>% 
  tidy_fu_allocation_table()
#> # A tibble: 268 × 13
#>    Country Method Energy.type Last.stage Ledger.side Flow.aggregation.point 
#>    <chr>   <chr>  <chr>       <chr>      <chr>       <chr>                  
#>  1 GHA     PCM    E           Final      Supply      Energy industry own use
#>  2 GHA     PCM    E           Final      Supply      Energy industry own use
#>  3 GHA     PCM    E           Final      Supply      Energy industry own use
#>  4 GHA     PCM    E           Final      Supply      Energy industry own use
#>  5 GHA     PCM    E           Final      Supply      Energy industry own use
#>  6 GHA     PCM    E           Final      Supply      Energy industry own use
#>  7 GHA     PCM    E           Final      Consumption Industry               
#>  8 GHA     PCM    E           Final      Consumption Industry               
#>  9 GHA     PCM    E           Final      Consumption Industry               
#> 10 GHA     PCM    E           Final      Consumption Industry               
#> # ℹ 258 more rows
#> # ℹ 7 more variables: Ef.product <chr>, Machine <chr>, Eu.product <chr>,
#> #   Destination <chr>, Quantity <chr>, Year <dbl>, .values <dbl>