View source: R/utils_state_fips.R
as_fips_code | R Documentation |
Convert between state names, postal abbreviations, and FIPS codes
as_fips_code(x)
as_state_abbreviation(x)
x |
A numeric or character vector of state names, postal abbreviations, or FIPS codes. Matches for state names and abbreviations are not case sensitive. FIPS codes may be matched from numeric or character vectors, with or without leading zeroes. |
as_state_fips_code()
A character vector of two-digit FIPS codes.
One-digit FIPS codes are prefixed with a leading zero,
e.g., "06"
for California.
as_state_abbreviation()
A character vector of two-letter postal abbreviations,
e.g., "CA"
for California.
as_fips_code("california")
as_state_abbreviation("california")
# Character vector matches ignore case
as_fips_code(c("DC", "Md", "va"))
as_state_abbreviation(c("district of columbia", "Maryland", "VIRGINIA"))
# Note that `3` and `7` are standardized to `NA`,
# because no state is assigned those FIPS codes
as_fips_code(1:10)
as_state_abbreviation(1:10)
# You can even mix methods in the same vector
as_fips_code(c("utah", "NM", 8, "04"))
as_state_abbreviation(c("utah", "NM", 8, "04"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.