countrycode: Convert Country Codes

Description Usage Arguments Note Examples

Description

Converts long country names into one of many different coding schemes. Translates from one scheme to another. Converts country name or coding scheme to the official short English country name. Creates a new variable with the name of the continent or region to which each country belongs.

Usage

1
countrycode(sourcevar, origin, destination, warn = FALSE, dictionary = NULL)

Arguments

sourcevar

Vector which contains the codes or country names to be converted

origin

Coding scheme of origin (name enclosed in quotes "")

destination

Coding scheme of destination (name enclosed in quotes "")

warn

Prints unique elements from sourcevar for which no match was found

dictionary

A data frame which supplies custom country codes. Variables correspond to country codes, observations must refer to unique countries. When countrycode uses a user-supplied dictionary, no sanity checks are conducted. The data frame format must resemble countrycode::countrycode_data. Custom dictionaries only work with strings (no regexes).

Note

Supports the following coding schemes: Correlates of War character, Gleditsch & Ward (1999) character, Gleditsch & Ward (1999) numeric, CoW-numeric, ISO3-character, ISO3-numeric, ISO2-character, IMF numeric, International Olympic Committee, FIPS 10-4, FAO numeric, United Nations numeric, World Bank character, official English short country names (ISO), continent, region.

The following strings can be used as arguments for origin or destination: "cowc", "cown", "iso3c", "iso3n", "iso2c", "imf", "gwn", "gwc", "fips104", "fao", "ioc", "un", "wb", "country.name". The following strings can be used as arguments for destination only: "continent", "region", "eu28", "ar5"

Examples

1
2
codes.of.origin <- countrycode::countrycode_data$cowc # Vector of values to be converted
countrycode(codes.of.origin, "cowc", "iso3c")

altaf-ali/countrycode_gw documentation built on May 15, 2019, 9:59 p.m.