Learn R Programming

Rnightlights (version 0.2.4)

ctryNameToCode: Convert country names to ISO3 codes

Description

Convert country names to ISO3 codes. Searches the rworldmap map data. With no parameters returns a list of ctryNames and their corresponding codes as given by rworldMap

Usage

ctryNameToCode(ctryNames)

Arguments

ctryNames

Character vector common names of countries to convert

Value

Character ISO3 ctryCode if found else NA

Examples

Run this code
# NOT RUN {
ctryNameToCode("kenya") #returns "KEN"

ctryNameToCode("ken") #returns "KEN"
  
ctryNameToCode("jamaica") #returns JAM

# }

Run the code above in your browser using DataLab