Take a vector of state identifiers and convert to a common format. Supports all five identifier types in state_ids: USPS abbreviation, full name, FIPS code, AP style abbreviation, and ISO 3166-2 code.
state_convert(x, to = c("abb", "name", "fips", "ap", "iso"))A character vector of single format state identifiers.
state_convert(c("AL", "Vermont", "06"))
#> [1] "AL" "VT" "CA"
state_convert(c("AL", "Vermont", "06"), to = "name")
#> [1] "Alabama" "Vermont" "California"
state_convert(c("AL", "Vermont", "06"), to = "fips")
#> [1] "01" "50" "06"
state_convert(c("AL", "Vermont", "06"), to = "ap")
#> [1] "Ala." "Vt." "Calif."
state_convert(c("AL", "Vermont", "06"), to = "iso")
#> [1] "US-AL" "US-VT" "US-CA"