Converts a vector of state names to an ISO 3166-2 two character state codes.
stateToCode(stateNames, countryCodes = NULL, dataset = "NaturalEarthAdm1")A vector of ISO 3166-2 codes or NA.
For this function to work, you must install and load the "NaturalEarthAdm1" dataset.
convertNaturalEarthAdm1
if (FALSE) { # \dontrun{
stateToCode("Washington")
stateToCode("Barcelona")
stateToCode("Shandong")
} # }