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

Republic of Kosovo (and derivations: Kosovo) returns NA for iso codes. Implement to return XK, XKK #355

Closed morrisseyj closed 5 months ago

morrisseyj commented 5 months ago

Republic of Kosovo (and derivations e.g. Kosovo) returns NA when destination is an iso code.

countrycode("Republic of Kosovo", "country.name", "iso3c")

and

countrycode("Republic of Kosovo", "country.name", "iso2c")

Both return:

[1] NA
Warning message:
Some values were not matched unambiguously: Republic of Kosovo

I appreciate that Kosovo only has partial diplomatic recognition, but its included as an IDA country and the World Bank has status in your package.

Could you implement to return XK or XKK?

cjyetman commented 5 months ago

Kosovo does not have an official ISO code (see https://www.iso.org/obp/ui/#search/code/).

I suggest using the custom_match argument...

countrycode("Republic of Kosovo", "country.name", "iso3c", custom_match = c("Republic of Kosovo" = "XKK"))
#> [1] "XKK"

countrycode("Republic of Kosovo", "country.name", "iso2c", custom_match = c("Republic of Kosovo" = "XK"))
#> [1] "XK"
vincentarelbundock commented 5 months ago

I don't remember the details of the arguments, but this has been discussed several times. If you want to file a feature request, please read the past closed issue and formulate counter-arguments to what was discussed there. For example:

https://github.com/vincentarelbundock/countrycode/issues/305 https://github.com/vincentarelbundock/countrycode/issues/306 https://github.com/vincentarelbundock/countrycode/issues/61

NilsEnevoldsen commented 5 months ago

Kosovo is not listed at https://www.iso.org/obp/ui/#search/code/, so we won't include an ISO code for it.

If you want to link to a World Bank dataset, you can use the wb, wb_api2c, or wb_api3c destination codes.

vincentarelbundock commented 5 months ago

Hahah, I think we all answered at the exact same time. This wasn't meant to be a pile on ;-)

morrisseyj commented 5 months ago

Apologies, i missed all these closed issues. Thanks for the excellent package. I use it constantly.