exemplar_lists: Create exemplar lists from an exemplar table

View source: R/exemplar_functions.R

exemplar_listsR Documentation

Create exemplar lists from an exemplar table

Description

An exemplar list is a list of countries or regions that should be used to complete a country's final-to-useful allocation table or its efficiency table. This function uses an exemplar table (probably read by load_exemplar_table()) to create exemplar lists.

Usage

exemplar_lists(
  exemplar_table,
  countries = NULL,
  prev_names = PFUWorkflow::exemplar_names$prev_names,
  exemplar_country = PFUWorkflow::exemplar_names$exemplar_country,
  exemplars = PFUWorkflow::exemplar_names$exemplars,
  region_code = PFUWorkflow::exemplar_names$region_code,
  world = PFUWorkflow::exemplar_names$world,
  country = IEATools::iea_cols$country,
  year = IEATools::iea_cols$year,
  year_temp = ".year_temp",
  prev_names_list = ".prev_names_list"
)

Arguments

exemplar_table

An exemplar table, probably read by load_exemplar_table().

countries

The countries for which exemplar lists are desired. Default is NULL, which returns all known countries.

exemplars, prev_names, exemplar_country, region_code, world

See PFUWorkflow::exemplar_names.

country, year

See IEATools::iea_cols.

year_temp

The name of a temporary year column. Default is ".year_temp".

prev_names_list

The name of a temporary column in exemplar_table. Default is ".prev_names_list".

Details

The value of this function is a tibble with three columns: Country, Year, and Exemplars. Country contains 3-letter ISO country codes or names of world regions. Year contains years. Exemplars contains a list of countries or regions that should serve as exemplars for the country in that year.

Order in each of the exemplar lists is important, because countries and regions will be searched in the order they appear in the sub-list when searching for missing allocations and efficiencies.

Value

A tibble containing countries and regions to be searched for missing final-to-useful allocation data or final-to-useful efficiency data.

Examples

# Use an exemplar table that is part of this package.
el <- exemplar_lists(load_exemplar_table()) %>%
# Montenegro is a particularly interesting case, as it had many name changes.
# Look at the first year, the last year as Yugoslavia, the first year as Serbia,
# and today.
  dplyr::filter(.data[[IEATools::iea_cols$country]] == "MNE",
                .data[[IEATools::iea_cols$year]] %in% c(1971, 1989, 1990, 2017))
el
el[[1, "Exemplars"]]
el[[2, "Exemplars"]]
el[[3, "Exemplars"]]
el[[4, "Exemplars"]]

MatthewHeun/SEAPSUTWorkflow documentation built on April 22, 2022, 2:21 p.m.