Convert Country Names and Country Codes

Standardize country names, convert them into one of eleven coding schemes, convert between coding schemes, and assign region descriptors.


News

Version 1.01.0 (2018-10-26)

  • Gleditsch and Ward codes (Thanks to Altaf Ali)
  • V-Dem 8 country codes (panel and cross-section)
  • Fixed Netherlands Antilles test (ANT code retired by ISO)
  • codelist_panel now excludes years where a country didn't exist
  • Scraping function for UN M49 codes. (Thanks to @cjyetman and @emilBeBri)
  • nomatch = NULL now works as expected when sourcvar is a factor (#192 thanks to @jhuovari for reporting)

Version 1.00.0 (2018-02-08)

  • Huge thanks to @cjyetman for his incredible work on this major release!
  • Country-Year (panel) conversion dictionary
  • Dictionary built from original sources
  • Liechtenstein should not be in eu28
  • Russia eurocontrol region fix
  • CLRD country names

Version 0.19.1 (2017-02-06)

Version 0.19 (2017-02-06)

New features

  • "custom_dict" argument allows user-supplied dictionary data.frames
  • "custom_match" argument allows a user-supplied named vector of custom origin->destination matches that will supercede any matching values in the default result (issue #107) (Thanks to @cjyetman)
  • German, French, Spanish, Russian, Chinese, and Arabic country names as destination codes
  • German regular expression to convert from German names to codes. (Thanks to @sumtxt)
  • Aviation codes (Thanks to Enrico Spinielli)
  • ar5 and eu28 (Thanks to Niklas Roming)
  • eurostat (Thanks to @cjyetman)
  • 2 and 3 character codes for the World Bank API: wb_api2c and wb_api3c (Thanks to @cjyetman)
  • alpha and numeric codes for Polity IV: p4_scode and p4_ccode (Thanks to @cjyetman)
  • World Values Survey numeric code (Thanks to @cjyetman)

Regex fixes and improvements:

  • Improved regex for Ireland and United States of America (Thanks to @cjyetman)
  • D.R. Congo (found in WVS) matches Democratic Republic of the Congo (Thanks to @cjyetman)
  • Southern Africa
  • Federated States of Micronesia
  • Republic of China == Taiwan (Thanks to Nils Enevoldsen)
  • Martinique (Thanks to Martyn Plummer)
  • Tahiti country name string converts to French Polynesia

Misc:

  • Major speed-up in regex conversion by using factors (Thanks to @cjyetman)
  • when more than one match is found for a given string, is returned rather than arbitrarily choosing the last match found (Thanks to @cjyetman)
  • updated tests to new testthat convention (Thanks to @cjyetman)
  • English country names are now official UN versions
  • Better docs, examples, and README
  • Taiwan FAO code is 214 (Thanks to Matthieu Stigler)

Version 0.18 (2014-12-17)

  • Nils Enevoldsen did wonderful work refactoring most of the regex in the dictionary.
  • Nils also added a bunch of tests. Thanks!
  • Added Tokelau

Version 0.17 (2014-07-15)

  • Added International Olympic Committee codes (Thanks to Devon Meunier)
  • Bug: fips04 -> fips104 (Thanks to Florian Hollenbach)
  • Complete FIPS104 codes (Thanks to Andy Halterman)
  • Generic code name validity check (Thanks to Stefan Zeugner)
  • Fixed IMF codes (Thanks to Stefan Zeugner)
  • Regex fix to work better with Database of Political Insitutions (Thanks to Christopher Gandrud)
  • Avoids confusion with Eq Guinea (Thanks to Christopher Gandrud)

Version 0.16 (2013-08-20)

  • Bug: NA cowc -> ABW (Thanks to Jon Mellon)

Version 0.15 (2013-07-21)

  • Regex fixes
    • Guinea
    • West Bank
    • Kitts / Christopher
    • Georgia / India
    • Mali
    • Sudan nigeria
    • Belgium
    • Korea Somalia
    • Oman

Version 0.14 (2013-05-30)

  • sint maarten typo

Version 0.13 (2013-03-19)

  • add sint maartin & curacao (thanks johnb30)

Version 0.12 (2013-03-08)

  • Missing wb codes filled-in using iso3c
  • Added South Sudan
  • Thanks to Rod Alence!

Version 0.11 (2013-02-12)

  • Vietnam cown
  • Regexes:
    • Dominica / Dominican Republic
    • New Zealand / Aland

Version 0.10 (2013-01-20)

  • De-duplicate Sudan
  • Niger vs. Nigeria regex

Version 0.9 (2012-12-26)

  • Fixed regexes: Mali, Korea, Oman, Dominica

Version 0.8 (2012-06-26)

  • Added World Bank (wb) country codes. Very similar, but slightly different from iso3c.

Version 0.7 (2012-06-01)

  • Removed useless functions countrycode.nomatch and countryframe
  • Fixed 2 Congo-related problems
  • Added option for countrycode() to report codes for which no match was found
  • Moved documentation to roxygen2
  • Fixed Trinidad Tobago regex
  • Added UN and FAO country codes

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("countrycode")

1.1.0 by Vincent Arel-Bundock, a year ago


https://github.com/vincentarelbundock/countrycode


Browse source code at https://github.com/cran/countrycode


Authors: Vincent Arel-Bundock [aut, cre] , CJ Yetman [ctb] , Nils Enevoldsen [ctb]


Documentation:   PDF Manual  


GPL-3 license


Suggests testthat


Imported by GSODR, MazamaSpatialUtils, auk, cranly, echarts4r, eurostat, idbr, psData, rwunderground, socialmixr, wdpar, xSub.

Suggested by c14bazAAR, datamaps, unvotes, widyr.


See at CRAN