Create exemplar lists from an exemplar table
exemplar_lists.Rd
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 = PFUPipeline::exemplar_names$prev_names,
exemplar_country = PFUPipeline::exemplar_names$exemplar_country,
exemplars = PFUPipeline::exemplar_names$exemplars,
region_code = PFUPipeline::exemplar_names$region_code,
world = PFUPipeline::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
- 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".
Value
A tibble containing countries and regions to be searched for missing final-to-useful allocation data or final-to-useful efficiency data.
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.
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
#> # A tibble: 4 × 3
#> Country Year Exemplars
#> <chr> <dbl> <list>
#> 1 MNE 1971 <chr [4]>
#> 2 MNE 1989 <chr [4]>
#> 3 MNE 1990 <chr [5]>
#> 4 MNE 2017 <chr [5]>
el[[1, "Exemplars"]]
#> [[1]]
#> [1] "YUG" "GRC" "EURP" "WRLD"
#>
el[[2, "Exemplars"]]
#> [[1]]
#> [1] "YUG" "GRC" "EURP" "WRLD"
#>
el[[3, "Exemplars"]]
#> [[1]]
#> [1] "SRB" "YUG" "GRC" "EURP" "WRLD"
#>
el[[4, "Exemplars"]]
#> [[1]]
#> [1] "SRB" "YUG" "GRC" "EURP" "WRLD"
#>