countryConversion: Conversion functions for country names, codes and FIPS codes.

countryConversionR Documentation

Conversion functions for country names, codes and FIPS codes.

Description

Converts a vector of country names or codes from one system to another returning NA where no match is found.

Usage

countryCodeToName(countryCode = NULL)

countryCodeToFIPS(countryCode = NULL)

countryFIPSToName(countryFIPS = NULL)

countryFIPSToCode(countryFIPS = NULL)

countryNameToCode(countryName = NULL)

countryNameToFIPS(countryName = NULL)

Arguments

countryCode

Vector of ISO 3166-1 alpha-2 codes.

countryFIPS

Vector of two-character FIPS codes.

countryName

Vector of English language country names.

Value

A vector of country names or codes.

Examples

library(MazamaSpatialUtils)

# FIPS codes are different!

countryNameToCode("Germany")
countryNameToFIPS("Germany")

countryCodeToName("CH")
countryFIPSToName("CH")

countryCodes <- sample(SimpleCountries$countryCode, 30)

data.frame(
  name = countryCodeToName(countryCodes),
  code = countryCodes,
  FIPS = countryCodeToFIPS(countryCodes)
)


MazamaSpatialUtils documentation built on Nov. 3, 2024, 9:07 a.m.