Skip to contents

Calculates total aggregate primary energy from a data frame of IEA data. This function works similar to dplyr::summarise(): it distills .ieadata to many fewer rows according to the grouping variables country, method, energy_type, last_stage, and year, and, possibly, additional grouping variables in the input (.ieadata). .ieadata is grouped by those variables internally. Any grouping variables present in .ieadata are retained for calculating primary aggregate energy. Grouping is removed before output.

Usage

primary_aggregates(
  .ieadata,
  country = IEATools::iea_cols$country,
  method = IEATools::iea_cols$method,
  energy_type = IEATools::iea_cols$energy_type,
  last_stage = IEATools::iea_cols$last_stage,
  year = IEATools::iea_cols$year,
  flow_aggregation_point = IEATools::iea_cols$flow_aggregation_point,
  e_dot = IEATools::iea_cols$e_dot,
  total_primary_energy_supply = IEATools::aggregation_flows$total_primary_energy_supply,
  ex_p = IEATools::aggregate_cols$aggregate_primary
)

Arguments

.ieadata

The data frame containing IEA data.

country, method, energy_type, last_stage, year, flow_aggregation_point, e_dot

See IEATools::iea_cols.

total_primary_energy_supply

See IEATools::aggregation_flows.

ex_p

See IEATools::aggregate_cols.

Value

A data frame containing the country, method, energy_type, last_stage, and year columns of .ieadata and a column named with the value of ex_p.

Examples

load_tidy_iea_df() %>% 
  primary_aggregates()
#> # A tibble: 4 × 6
#>   Country Method EnergyType LastStage  Year      EXp
#>   <chr>   <chr>  <chr>      <chr>     <dbl>    <dbl>
#> 1 GHA     PCM    E          Final      1971  125469.
#> 2 GHA     PCM    E          Final      2000  264914.
#> 3 ZAF     PCM    E          Final      1971 1902057.
#> 4 ZAF     PCM    E          Final      2000 4575874.