Skip to contents

Getting Data

There are two methods for getting data from countyfipsR. First, countyfipsR contains a tibble data frame, countyfips, for easily accessing unfiltered county data.

library(countyfipsR)

head(countyfips)
#> # A tibble: 6 × 7
#>   fips  county_name    state_name state_abb state_fips county_fips county_ns
#>   <chr> <chr>          <chr>      <chr>     <chr>      <chr>           <dbl>
#> 1 01001 Autauga County Alabama    AL        01         001            161526
#> 2 01003 Baldwin County Alabama    AL        01         003            161527
#> 3 01005 Barbour County Alabama    AL        01         005            161528
#> 4 01007 Bibb County    Alabama    AL        01         007            161529
#> 5 01009 Blount County  Alabama    AL        01         009            161530
#> 6 01011 Bullock County Alabama    AL        01         011            161531

The second method, get_countyfips allows for easy filtering of data by state. Simply, specify the state or territory you would like, and get_countyfips returns a tibble of the requested data.

dataIL <- get_countyfips(state = "illinois")

head(dataIL)
#> # A tibble: 6 × 7
#>   fips  county_name      state_name state_abb state_fips county_fips county_ns
#>   <chr> <chr>            <chr>      <chr>     <chr>      <chr>           <dbl>
#> 1 17001 Adams County     Illinois   IL        17         001            424202
#> 2 17003 Alexander County Illinois   IL        17         003            424203
#> 3 17005 Bond County      Illinois   IL        17         005            424204
#> 4 17007 Boone County     Illinois   IL        17         007            424205
#> 5 17009 Brown County     Illinois   IL        17         009            424206
#> 6 17011 Bureau County    Illinois   IL        17         011            424207

Merging Data

Since the resultant data are a tibble, merging is relatively straightforward.

GNIS https://www.usgs.gov/us-board-on-geographic-names/download-gnis-data