Skip to contents

Convert a state name, abbreviation, or county name to FIPS codes

Usage

as_fips(state, county = NULL)

Arguments

state

State names, state abbreviations, or one of the following: "all", "conus", "territories"

county

County names or "all"

Value

a character vector

Examples

fipio::as_fips(state = "California")
#> [1] "06"
fipio::as_fips(state = "NC")
#> [1] "37"
fipio::as_fips(state = "Rhode Island", county = "Washington")
#> [1] "44009"
fipio::as_fips(c("CA", "North Carolina"), c("Stanislaus", "NEW HANOVER"))
#> [1] "06099" "37129"
fipio::as_fips("CONUS")
#>  [1] "01" "04" "05" "06" "08" "09" "10" "11" "12" "13" "16" "17" "18" "19" "20"
#> [16] "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35"
#> [31] "36" "37" "38" "39" "40" "41" "42" "44" "45" "46" "47" "48" "49" "50" "51"
#> [46] "53" "54" "55" "56"
fipio::as_fips(state = "NC", county = "all")
#>   [1] "37001" "37003" "37005" "37007" "37009" "37011" "37013" "37015" "37017"
#>  [10] "37019" "37021" "37023" "37025" "37027" "37029" "37031" "37033" "37035"
#>  [19] "37037" "37039" "37041" "37043" "37045" "37047" "37049" "37051" "37053"
#>  [28] "37055" "37057" "37059" "37061" "37063" "37065" "37067" "37069" "37071"
#>  [37] "37073" "37075" "37077" "37079" "37081" "37083" "37085" "37087" "37089"
#>  [46] "37091" "37093" "37095" "37097" "37099" "37101" "37103" "37105" "37107"
#>  [55] "37109" "37111" "37113" "37115" "37117" "37119" "37121" "37123" "37125"
#>  [64] "37127" "37129" "37131" "37133" "37135" "37137" "37139" "37141" "37143"
#>  [73] "37145" "37147" "37149" "37151" "37153" "37155" "37157" "37159" "37161"
#>  [82] "37163" "37165" "37167" "37169" "37171" "37173" "37175" "37177" "37179"
#>  [91] "37181" "37183" "37185" "37187" "37189" "37191" "37193" "37195" "37197"
#> [100] "37199"