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 EnergyType LastStage LedgerSide FlowAggregationPoint EfProduct
#>    <chr>   <chr>  <chr>      <chr>     <chr>      <chr>                <chr>    
#>  1 GHA     PCM    E          Final     Supply     Energy industry own… Refinery…
#>  2 GHA     PCM    E          Final     Supply     Energy industry own… Refinery…
#>  3 GHA     PCM    E          Final     Supply     Energy industry own… Electric…
#>  4 GHA     PCM    E          Final     Supply     Energy industry own… Electric…
#>  5 GHA     PCM    E          Final     Supply     Energy industry own… Electric…
#>  6 GHA     PCM    E          Final     Supply     Energy industry own… Electric…
#>  7 GHA     PCM    E          Final     Consumpti… Industry             Electric…
#>  8 GHA     PCM    E          Final     Consumpti… Industry             Electric…
#>  9 GHA     PCM    E          Final     Consumpti… Industry             Electric…
#> 10 GHA     PCM    E          Final     Consumpti… Industry             Electric…
#> # ℹ 258 more rows
#> # ℹ 6 more variables: Machine <chr>, EuProduct <chr>, Destination <chr>,
#> #   Quantity <chr>, Year <dbl>, Value <dbl>