zipcodeR is an R package I built to make ZIP code data easier to work with. If you’ve tried to do ZIP code-level analysis in R before, you know the pain — no clean way to get boundaries, no straightforward link between geographic and demographic data, and distance calculations that require cobbling together multiple packages.
zipcodeR handles all of that in one package.
ZIP Code Lookups
library(zipcodeR)
# Get detailed info about a ZIP code
zip_code_db %>% filter(zipcode == "08742")
# Search by city
search_city("Trenton", "NJ")
Distance Calculations
# Distance between two ZIP codes
zip_distance("08742", "08618")
# Find all ZIP codes within radius
search_radius("08742", radius = 10)
Demographics
Population, income, and housing data built in:
# Get demographic statistics
reverse_zipcode("08742")
Spatial Analysis
# Get ZIP code boundaries
get_zcta_boundary("08742")
Where I’ve Used It
I’ve used zipcodeR in public health analysis (identifying healthcare deserts), mapping OPRA requests by location through OPRAmachine, and electoral demographics work. The package ships with a local SQLite database, so lookups run in milliseconds with no API calls or network dependency.
Installation
# From CRAN
install.packages("zipcodeR")
# Development version from GitHub
devtools::install_github("gavinrozzi/zipcodeR")
Open Source
zipcodeR is fully open source under the GPL-3 license. Contributions welcome!
Academic Publication
The package has a peer-reviewed paper in Software Impacts: DOI: 10.1016/j.simpa.2021.100147. It’s been cited over 53 times and downloaded more than 115,000 times from CRAN.
If you’re using zipcodeR and run into issues or have feature ideas, open an issue on GitHub.