Country codes. The bane of geographers, political scientists, and a variety of research fields. Despite a handful of tools developed to address the issue of matching and harmonizing country codes between disparate data sets, there still remains several gaps and inefficiencies.  Although the widely used R package countrycode provides fantastic tools for converting between codes, it often struggles with several climate-security datasets. These can be the result of odd nomenclature, typos, missing values, or a slew of other unforeseen issues that arise when attempting to harmonize nation-state data. In addition to source data errors, countrycode may generate unnoticed one-to-many or many-to-one conversions and fail to produce values for disputed or  nation-states not recognized by international organizations. 

commonCodes supplements the countrycode package by providing a multitude of "hardcoded" fixes for typos, missing data, and other errors pervasive in a variety of climate security datasets. The end result is a singular data.frame with a harmonized listing of countries from several datasets, widely used coding schemes, and their membership status for multiple international organizations.

Supported Datasets and Schemes

The commonCodes packages includes entries for 260 nation-states and territories, their written name as presented in the associated dataset, their official code in several widely used schemes, and membership status in multiple international organizations.


  • Global Administrative Boundaries (GADM)
  • The `raster` package's country codes dataset
  • United Nations High Commissioner for Refugees Populations of Concern
    • Refugee Time Series
    • Asylum Applications
    • Asylum Applications Decisions
    • Internal Displacement Monitoring Center's IDPs
  • United Nations Migrant Stock Populations (2019 Revision)
  • United Nations Migrant Stock Populations (2017 Revision)
  • Mass Episodes of Political Violence (MEPV)
  • International Monetary Direction of Trade Statistics (Annual)
  • International Monetary Direction of Trade Statistics (Monthly)

Coding Schemes

  • International Organization for Standardization
  • The Correlates of War Project
  • Gleditsch and Ward country codes

International Memberships

  • Organization for Economic Co-operation and Development (OECD)
  • European Union (EU)

Additional Information

For more detailed information about the commonCodes, please refer to the package website and refence manual. To contribute to commonCodes or report a bug, refer to the GitLab repository