state_convert: Convert state identifiers

View source: R/state-convert.R

state_convertR Documentation

Convert state identifiers

Description

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.

Usage

state_convert(x, to = c("abb", "name", "fips", "ap", "iso"))

Arguments

x

A character vector of state identifiers in any supported format.

to

The format returned: "abb", "name", "fips", "ap", or "iso". Defaults to "abb".

Value

A character vector of single format state identifiers.

Examples

state_convert(c("AL", "Vermont", "06"))
state_convert(c("AL", "Vermont", "06"), to = "name")
state_convert(c("AL", "Vermont", "06"), to = "fips")
state_convert(c("AL", "Vermont", "06"), to = "ap")
state_convert(c("AL", "Vermont", "06"), to = "iso")

usa documentation built on May 14, 2026, 5:08 p.m.