read_aggregation_region_table: Loads region aggregation table

View source: R/aggregates.R

read_aggregation_region_tableR Documentation

Loads region aggregation table

Description

This functions loads a user-defined aggregation table that re-routes each IEA region to a user-defined region. By default, the concordance matrix used re-routes IEA regions to Exiobase regions (for 2019 version of IEA data). See details for more information.

Usage

read_aggregation_region_table(
  file_path = default_aggregation_region_table_path(2019),
  country = IEATools::iea_cols$country,
  iea_regions = "IEA_regions",
  destination_regions = "Destination_regions"
)

Arguments

file_path

The path of the file (xlsx file) to be loaded. The default path leads to an aggregation table converting IEA regions into Exiobase regions for 2019 IEA data. Using the default_aggregation_region_table_path() function, the user can select the default IEA regions to Exiobase regions aggregation table for a different year.

country

The name of the ⁠country`` column in the aggregation table returned by the data frame. This column contains ISO codes for the ⁠iea_regions⁠column of the aggregation table. Default is⁠IEATools::iea_cols$country'.

iea_regions

The name of the column containing IEA regions in the aggregation table. Default is "IEA_regions".

destination_regions

The name of the column containing the destination regions. Default is "Destination_regions".

Details

The aggregation table must have a column that identifies the IEA regions to be re-routed (default is "IEA_regions"), and a second column that identifies the new regions to IEA regions are re-routed (default is "Destination_regions"). There is no need to include all IEA regions; those that are not included will be removed when calling the aggregate_regions() function. IEA regions that are rerouted to "NA" or to an empty value are also removed when calling the aggregate_regions() function.

Note that the default IEA to Exiobase mapping are only valid for the time periods relevant to Exiobase (from 1995 onward). Using it for previous years will lead to a situation where the energy consumption of particular countries, like Former Soviet Union or Former Yugoslavia, disappear from the data frame (because they do not correspond to an Exiobase region.

Value

A three column concordance table (as a data frame) mapping the iea_regions column to a destination_regions column, using a country column (with ISO country IDs) as intermediate, which is added to the loaded aggregation table within the function. For those IEA regions that do not match to an ISO code (for instance, "World marine bunkers"), the full IEA region name is kept in the country column.

Examples

# Returns the default aggregation table for the year 2019
read_aggregation_region_table()
# Returns the default aggregation table for the year 2020
read_aggregation_region_table(file_path = default_aggregation_region_table_path(2020))

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