US_countyConversion | R Documentation |
Converts a vector of US county names or FIPS codes from one
system to another reuturning NA
where no match is found.
US_countyNameToFIPS(state = NULL, countyName = NULL)
US_countyFIPSToName(state = NULL, countyFIPS = NULL)
state |
Vector of state codes, names or FIPS codes. Values will be evaluated to determine the type of input. |
countyName |
Vector of English language county names. |
countyFIPS |
Vector of two-digit FIPS codes. |
A vector of US county names or FIPS codes.
library(MazamaSpatialUtils)
US_countyNameToFIPS("Washington", "King")
# If a single state is provided, it will be recycled
US_countyNameToFIPS("Washington", c("King", "Okanogan"))
# Normally, equal length vectors are provided
US_countyNameToFIPS(c("WA", "WA"), c("King", "Okanogan"))
# You cannot mix codes!
US_countyNameToFIPS(c("WA", "Washington"), c("King", "Okanogan"))
# No 'Okanogan' county in Texas
US_countyNameToFIPS(c("WA", "TX"), c("King", "Okanogan"))
# But there is a 'King' county in Texas
US_countyNameToFIPS(c("TX", "WA"), c("King", "Okanogan"))
US_countyNameToFIPS(c("TX", "WA"), c("King", "King"))
# The US_countyFIPSToName() function is included for symmetry but a
# more typical usage of a 5-digit county FIPS would be to extract it from
# the US_countyCodes package dataset:
US_countyCodes %>% dplyr::filter(countyFIPS == 53033)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.