finaldemand_aggregates: Final demand aggregate energy from IEA tables

View source: R/aggregates.R

finaldemand_aggregatesR Documentation

Final demand aggregate energy from IEA tables

Description

Calculates total aggregate final demand energy from a data frame of IEA data on both net and gross bases.

Usage

finaldemand_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,
  ledger_side = IEATools::iea_cols$ledger_side,
  flow_aggregation_point = IEATools::iea_cols$flow_aggregation_point,
  flow = IEATools::iea_cols$flow,
  e_dot = IEATools::iea_cols$e_dot,
  consumption = IEATools::ledger_sides$consumption,
  eiou = IEATools::tfc_compare_flows$energy_industry_own_use,
  diff_colname = ".gross_less_net",
  net_aggregate_demand = IEATools::aggregate_cols$net_aggregate_demand,
  gross_aggregate_demand = IEATools::aggregate_cols$gross_aggregate_demand
)

Arguments

.ieadata

A data frame with columns of IEA data.

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

See IEATools::iea_cols.

consumption

See IEATools::ledger_sides.

eiou

See IEATools::tfc_compare_flows.

diff_colname

The name of a column containing differences between gross and net final demand. Default is ".gross_less_net".

net_aggregate_demand, gross_aggregate_demand

See IEATools::aggregate_cols.

Details

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.

Value

A data frame containing grouping columns of .ieadata and two additional columns containing net and gross final demand.

Examples

load_tidy_iea_df() %>% 
  finaldemand_aggregates()

MatthewHeun/IEATools documentation built on Feb. 6, 2024, 3:29 p.m.