zipcodeR
The R package powering peer-reviewed research worldwide
About zipcodeR
zipcodeR is an R package enabling breakthrough research across public health, epidemiology, economics, and environmental science. Created by Gavin Rozzi and published on CRAN, the package has been cited in Nature, Cancer Discovery, and other leading peer-reviewed journals.
Whether you're calculating distances between ZIP codes, looking up demographic information, performing spatial joins, or building maps, zipcodeR provides a clean, intuitive interface that handles the complexity of ZIP code data for you.
The package includes an embedded SQLite database with comprehensive ZIP code data, ensuring fast lookups without external API dependencies. It's well-documented, actively maintained, and follows modern R development best practices.
Research Impact
With 49 peer-reviewed citations and growing, zipcodeR has become essential infrastructure for spatial research across medicine, public health, economics, and environmental science.
Multiethnic Skin Cancer Risk Model
Machine learning model addressing health disparities in skin cancer detection across ethnic groups.
2025 Cancer DiscoveryNCI Clinical Trial Demographics
Analysis of demographic representation in early-phase cancer research trials from 2000-2023.
2025 J Am Heart AssocCongenital Heart Disease Care Gaps
Social determinants of health and child opportunity index implications for pediatric cardiac care.
2024 European Economic ReviewCOVID-19 Behavioral Response
How political ideology influenced pandemic-related behaviors and prosocial responses.
2023 Environmental ResearchAir Pollution & Cognitive Decline
Ultrafine particle exposure and aging-related cognitive impairment in older Americans.
2023 OphthalmologyGlaucoma Surgery Access
Geographic distribution analysis of surgical access using the IRIS Registry.
2025 Communications MedicinePrematurity & Pediatric Asthma
Environmental pollution and genetic susceptibility impact on premature infant outcomes.
2025 M&SOMOutpatient Clinic Visit Incompletion
Empirical study of waiting dynamics in online vs. in-person healthcare settings.
2025View all 49 citations on Google Scholar
Installation
# Install from CRAN
install.packages("zipcodeR")
# Or install development version from GitHub
# install.packages("remotes")
remotes::install_github("gavinrozzi/zipcodeR") Key Features
Distance Calculations
Compute geodesic distances between ZIP codes using the Haversine formula. Perfect for delivery routing, service area analysis, and proximity searches.
Demographic Data
Access population, income, housing, and other census statistics by ZIP code. Great for market research and demographic analysis.
Geographic Boundaries
Retrieve ZIP code boundary polygons for mapping and spatial analysis. Works seamlessly with sf and leaflet packages.
ZIP Code Lookups
Search ZIP codes by city, county, state, or coordinates. Reverse geocode lat/lon to ZIP codes instantly.
Example Usage
library(zipcodeR)
# Look up information for a ZIP code
zip_info <- reverse_zipcode("08901")
# Calculate distance between two ZIP codes
distance <- zip_distance("08901", "10001")
# Get all ZIP codes in a state
nj_zips <- search_state("NJ")
# Find ZIP codes within radius
nearby <- search_radius("08901", radius = 25) Publications
Related Articles
A Spatial Analysis of New Jersey's Medical Cannabis Dispensary Accessibility
An isochrone-based GIS analysis revealing that over 756,000 New Jerseyans in 110 municipalities face 30+ minute drives to the nearest medical cannabis dispensary.
Apr 17, 2022New Jersey's official geocoding API now has a client for R
Using New Jersey's official state geocoding service just got easier! This post introduces njgeo, a new R package that simplifies working with New Jersey-specific spatial datasets.
Feb 4, 20222022 New Jersey Congressional Redistricting Map
An analysis and visualization of New Jersey's new congressional districts adopted by the Redistricting Commission, created using R and Leaflet.
Jan 2, 2022What Social Media Data Tells Us About the 2021 New Jersey Governor's Race
A sentiment analysis of tweets about the Murphy-Ciattarelli gubernatorial race reveals key differences in campaign rhetoric, word choice, and online engagement.
Oct 3, 2021