Closed huizezhang-sherry closed 2 years ago
Thanks a lot for the report!
Continents are tricky because, as the wikipedia entry about them notes, they are defined by convention rather than authority. As such, different sources will use different groupings. There are basically two separate issues here:
NA
values in the current continent
code.Absolutely! We should definitely fill-in those missing values. This should be done by adding new rows to this file: https://github.com/vincentarelbundock/countrycode/blob/main/dictionary/data_regions.csv
The missing entries are:
cl <- countrycode::codelist
cl[is.na(cl$continent), "country.name.en"] |> paste(collapse = ", ")
# [1] "c(\"Antarctica\", \"Austria-Hungary\", \"Baden\", \"Bavaria\", \"Bouvet Island\", \"British Indian Ocean Territory\", \"Brunswick\", \"Channel Islands\", \"Cocos (Keeling) Islands\", \"Czechoslovakia\", \"French Southern Territories\", \"German Democratic Republic\", \"Hamburg\", \"Hanover\", \"Heard & McDonald Islands\", \"Hesse Electoral\", \"Hesse Grand Ducal\", \"Hesse-Darmstadt\", \"Hesse-Kassel\", \"Kosovo\", \"Mecklenburg Schwerin\", \"Modena\", \"Nassau\", \"Oldenburg\", \"Orange Free State\", \"Parma\", \"Piedmont-Sardinia\", \"Prussia\", \"Sardinia\", \n\"Saxe-Weimar-Eisenach\", \"Saxony\", \"Serbia and Montenegro\", \"South Georgia & South Sandwich Islands\", \"Tuscany\", \"Two Sicilies\", \"United Province CA\", \"United States Minor Outlying Islands (the)\", \"Wuerttemburg\", \"Würtemberg\", \"Yemen Arab Republic\", \"Yemen People's Republic\", \"Yugoslavia\", \"Zanzibar\")"
A few things to keep in mind here:
continent
.countrycode
, but wanting to cover them all is a deeeep rabbit hole.In sum, to make a change we would need to make sure that it either fixes an uncontroversial error in the current codes, or that it adds significant value.
Note that countrycode
already includes several other region grouping, which would make it very easy for you to split North/South America. For example, checkout the un.regionsub.name
:
countrycode::countrycode("Canada", "country.name", "un.regionsub.name")
# [1] "Northern America"
Since we already have several region/continent codes, and since I am unlikely to work on this myself, I will close the issue to clean the repo. But anyone should feel free to re-open or keep commenting if they intend to prepare submit code via a pull request.
In the
codelist
, possible values of thecontinent
column include Asia, Europe, Africa, Oceania, Americas, and NA, while it could be more useful to separate "Americas" into North and South America.Data sources that maps country into continent include here, here and here. In these sources, continents are divided into
I'm happy to make PR if the maintainer likes this idea.