View source: R/MazamaSpatialUtils.R
stateToCode | R Documentation |
Converts a vector of state names to an ISO 3166-2 two character state codes.
stateToCode(stateNames, countryCodes = NULL, dataset = "NaturalEarthAdm1")
stateNames |
Vector of state names to be converted. |
countryCodes |
Vector of ISO 3166-2 alpha-2 country codes the state might be found in. |
dataset |
Name of dataset containing state-level identifiers. |
For this function to work, you must install and load the "NaturalEarthAdm1" dataset.
A vector of ISO 3166-2 codes or NA.
convertNaturalEarthAdm1
## Not run:
stateToCode("Washington")
stateToCode("Barcelona")
stateToCode("Shandong")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.