-
Notifications
You must be signed in to change notification settings - Fork 13
Add fips codes to reverse_zipcode()
output?
#7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Actually, the table I provided is not sufficient for fips codes. There are locations that are valid but not in this table. For example: library(zipcodeR)
#> Loading required package: dplyr
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
#> Loading required package: stringr
reverse_zipcode("22311")
#> 1 row of data found for ZIP code: '22311'
#> # A tibble: 1 x 24
#> zipcode zipcode_type major_city post_office_city common_city_list county state
#> <chr> <chr> <chr> <chr> <list<raw>> <chr> <chr>
#> 1 22311 Standard Alexandria Alexandria, VA [22] Alexa… VA
#> # … with 17 more variables: lat <dbl>, lng <dbl>, timezone <chr>,
#> # radius_in_miles <dbl>, area_code_list <list<raw>>, population <int>,
#> # population_density <dbl>, land_area_in_sqmi <dbl>,
#> # water_area_in_sqmi <dbl>, housing_units <int>,
#> # occupied_housing_units <int>, median_home_value <int>,
#> # median_household_income <int>, bounds_west <dbl>, bounds_east <dbl>,
#> # bounds_north <dbl>, bounds_south <dbl>
reverse_zipcode("22311")$county
#> 1 row of data found for ZIP code: '22311'
#> [1] "Alexandria city" Created on 2021-04-04 by the reprex package (v1.0.0) The output is correct, as Alexandria City is not in a county. There is a fips code, though. I believe it should be 51510. |
Hello Claus! Thanks for the suggestion and your other issues - I appreciate your comments. I'll take a look at these as I work on finishing out the next round of updates. |
Super, thanks! |
I have spent some time matching up zip codes with FIPS codes and manually cleaning up any inconsistencies. The result is not perfect, but it works quite well on a very large real-world dataset I'm dealing with. The final data table is here: https://github.com/clauswilke/zipcodes/blob/main/data/zip2fips.csv And the code I wrote to generate it can be found here: https://github.com/clauswilke/zipcodes |
I'm interested in linking zip codes back to counties. It looks like
reverse_zipcode()
can in principle provide the data I want. However, it only lists county names, not fips codes, as far as I can tell. Would it be possible to add fips codes? It always makes me uncomfortable working with full county names because of the possibility of misspelling or alternative spellings.A simple translation table from county names to fips codes is available here:
https://www.nrcs.usda.gov/wps/portal/nrcs/detail/national/home/?cid=nrcs143_013697
The text was updated successfully, but these errors were encountered: