vincentarelbundock / countrycode

R package: Convert country names and country codes. Assigns region descriptors.
https://vincentarelbundock.github.io/countrycode
GNU General Public License v3.0
342 stars 84 forks source link

Replaced ESRA by ECAC in eurocontrol_statfor #351

Closed sthonnard closed 6 months ago

sthonnard commented 6 months ago

ESRA is deprecated and has to be replaced by ECAC. https://www.eurocontrol.int/sites/default/files/2020-11/eurocontrol-forecast-2020-2024-region-definition.pdf

I redistributed countries to their proper STATFOR zone with the following code:

load(file='codelist.rda') 

codelist[codelist$country.name.en %in% c("Czechia","Estonia","Finland","Latvia", "Lithuania", "Norway", "Poland", "Slovakia", 
                                         "Sweden", "Ukraine","Åland Islands"),]$eurocontrol_statfor <- "ECAC North-East"

codelist[codelist$country.name.en %in% c("Austria","Belgium","Luxembourg","Denmark", "France", "Germany", "Liechtenstein", 
                                         "German Democratic Republic", 
                                         "Monaco",
                                         "Ireland", "Netherlands", "Switzerland", "United Kingdom", "Guernsey", 
                                         "Jersey", "Isle of Man"),]$eurocontrol_statfor <- "ECAC North-West"

codelist[codelist$country.name.en %in% c("Albania","Armenia","Azerbaijan", "Bosnia & Herzegovina", "Bulgaria", "Croatia", 
                                         "Cyprus", "Georgia", "Greece", "Hungary",
                                         "Italy", "Malta", "Moldova", "North Macedonia", "Romania", 
                                         "Serbia and Montenegro", "Serbia",
                                         "Slovenia", "Turkey", "Montenegro"),]$eurocontrol_statfor <- "ECAC South-East"

codelist[codelist$country.name.en %in% c("Spain","Portugal","Gibraltar"),]$eurocontrol_statfor <- "ECAC South-West"

codelist[codelist$country.name.en %in% c("Iceland", "Faroe Islands", "Svalbard & Jan Mayen"),]$eurocontrol_statfor <- "ECAC-Oceanic"

codelist[codelist$country.name.en %in% c("Belarus","Greenland","Russia"),]$eurocontrol_statfor <- "Other Europe"

codelist[codelist$country.name.en %in% c("St. Pierre & Miquelon"),]$eurocontrol_statfor <- "North Atlantic"

error <- codelist |> filter(stringr::str_detect(eurocontrol_statfor,"ESRA")) 
nrow(error)
# 0

save(codelist, file='codelist.rda')
vincentarelbundock commented 6 months ago

Thanks a lot for this @sthonnard

Unfortunately, that file gets overwritten every time.we build the package. Instead, we need to edit the CSV file here: https://github.com/vincentarelbundock/countrycode/blob/main/dictionary%2Fdata_aviation.csv

If you do that, I'll be happy to rebuild and release to CRAN.