From the course: Creating Maps with R

Standardize country names with {countrycode}

From the course: Creating Maps with R

Standardize country names with {countrycode}

- [Instructor] Country names are very messy and complicated for perfect examples of human datasets. The names that we use depend on who we are, who we're speaking to, and what we are doing with the country names. Let's look at five example countries. The USA is a very easy example to look at. It's often abbreviated to USA or US. But there are multiple ways we could expand that acronym to simply United States or United States of America. Next, we come to official versus common use names. Often, we think we know the name of a country, for instance France, but officially, it's the French Republic. And that's not the end of things, even for official names. These have abbreviations, too. For instance, Germany might be recorded as Fed. Rep. Germany instead of the official name Federal Republic of Germany. The simplest way around these complications is to use internationally recognized codes for country names. But there are at least eight widely used international country coding systems in use today. Thankfully, an R package called countrycode provides a programmatic approach to disambiguate country names and converting backwards and forwards to country codes.

Contents