zipcoder

An R package that makes working with U.S. ZIP codes painless.

https://github.com/gavinrozzi/zipcoder

Science Score: 33.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
    Links to: sciencedirect.com
  • Committers with academic emails
    1 of 2 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (21.1%) to scientific vocabulary

Keywords

r rstats
Last synced: 10 months ago · JSON representation

Repository

An R package that makes working with U.S. ZIP codes painless.

Basic Info
Statistics
  • Stars: 81
  • Watchers: 7
  • Forks: 13
  • Open Issues: 13
  • Releases: 6
Topics
r rstats
Created almost 6 years ago · Last pushed over 2 years ago
Metadata Files
Readme License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
library(tibble)
```

# zipcodeR 


[![R-CMD-check](https://github.com/gavinrozzi/zipcodeR/workflows/R-CMD-check/badge.svg)](https://github.com/gavinrozzi/zipcodeR/actions)
[![codecov](https://codecov.io/gh/gavinrozzi/zipcodeR/branch/master/graph/badge.svg?token=9HDL7QUPCE)](https://app.codecov.io/gh/gavinrozzi/zipcodeR)
[![CRAN Status](https://www.r-pkg.org/badges/version-last-release/zipcodeR)](https://www.r-pkg.org/badges/version-last-release/zipcodeR)
[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/grand-total/zipcodeR)](https://cranlogs.r-pkg.org/badges/grand-total/zipcodeR)
[![CRAN Downloads Per Month](https://cranlogs.r-pkg.org/badges/last-month/zipcodeR)](https://cranlogs.r-pkg.org/badges/grand-total/zipcodeR)


### Makes dealing with U.S. ZIP codes painless.

`{zipcodeR}` is an R package that makes working with ZIP codes in R easier. It provides data on all U.S. ZIP codes using multiple open data sources, making it easier for social science researchers and data scientists to work with ZIP code-level data in data science projects using R.

The latest update to `{zipcodeR}` includes new functions for [searching ZIP codes at various geographic levels & geocoding.](https://gavinrozzi.github.io/zipcodeR/articles/geographic.html)

## Installation

You can install the released version of zipcodeR from [CRAN](https://CRAN.R-project.org) with:

``` r
install.packages("zipcodeR")
```

And the development version from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("gavinrozzi/zipcodeR")
```

## Citing `{zipcodeR}` in Publications

If you use `{zipcodeR}` in a publication, please cite the following [journal article](https://www.sciencedirect.com/science/article/pii/S2665963821000373/).

A BibTeX entry for LaTeX users is:

```bibtex
@article{ROZZI2021100099,
title = {zipcodeR: Advancing the analysis of spatial data at the ZIP code level in R},
journal = {Software Impacts},
volume = {9},
pages = {100099},
year = {2021},
issn = {2665-9638},
doi = {https://doi.org/10.1016/j.simpa.2021.100099},
url = {https://www.sciencedirect.com/science/article/pii/S2665963821000373},
author = {Gavin C. Rozzi},
keywords = {ZIP code, R, ZCTA, ZIP code tabulation area, zipcodeR},
abstract = {The United States Postal Service (USPS) assigns unique identifiers for postal service areas known as ZIP codes which are commonly used to identify cities and regions throughout the United States in datasets. Despite the widespread use of ZIP codes, there are challenges in using them for geospatial analysis in the social sciences. This paper presents zipcodeR, an R package that facilitates analysis of ZIP code-level data by providing an offline database of ZIP codes and functions for geocoding, normalizing and retrieving data about ZIP codes and relating them to other geographies in R without depending on any external services.}
}
```

## Examples


```{r}
# Load zipcodeR into R
library(zipcodeR)
```


### Find all ZIP codes for a state

```{r}
search_state('NJ')
```

### Calculate the distance between two ZIP codes in miles

```{r}
zip_distance('08901','08731')
```


### Calculate the distance between vectors of ZIP codes

```{r}
zip_codes <- tribble(~zip_a,  ~zip_b,
"08731",  "08901",
"08734",  "08005")

zip_distance(zip_codes$zip_a,zip_codes$zip_b)
```

### Geocode a ZIP code to get its centroid
```{r}
geocode_zip('08901')
```

### Get data about a ZIP code
```{r}
reverse_zipcode('08901')
```

### Find all ZIP codes for a county
```{r}
search_county('Ocean','NJ')
```


### Find all ZIP codes for a city
```{r}
search_city('Jersey City','NJ')
```

### Find all ZIP codes for a timezone
```{r}
search_tz('Eastern')
```

### Get all Census tracts for a given ZIP code
```{r}
get_tracts('08731')
```

## Documentation
Documentation for the current release [is available here.](https://gavinrozzi.github.io/zipcodeR/)
See the [reference section](https://gavinrozzi.github.io/zipcodeR/reference/) for full details on how to use each of the functions provided by zipcodeR.

## Data Sources
This project was inspired by the excellent [uszipcode](https://uszipcode.readthedocs.io/index.html) library for Python and utilizes the same backend database released by its author under the MIT license. This project also incorporates open data from the U.S. Census Bureau and Department of Housing & Urban Development.

Owner

  • Name: Gavin Rozzi
  • Login: gavinrozzi
  • Kind: user
  • Location: New Jersey
  • Company: 39 North Labs, LLC.

I seek new ways to use data science for public good & to solve problems through evidence-based policy. Previously @RUCILab and the New Jersey Policy Lab.

GitHub Events

Total
  • Issues event: 1
  • Watch event: 2
  • Issue comment event: 2
Last Year
  • Issues event: 1
  • Watch event: 2
  • Issue comment event: 2

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 136
  • Total Committers: 2
  • Avg Commits per committer: 68.0
  • Development Distribution Score (DDS): 0.015
Past Year
  • Commits: 11
  • Committers: 2
  • Avg Commits per committer: 5.5
  • Development Distribution Score (DDS): 0.182
Top Committers
Name Email Commits
Gavin Rozzi gr@g****m 134
Lee, Nicholas Xiang Rong n****e@g****u 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 24
  • Total pull requests: 6
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 9 days
  • Total issue authors: 20
  • Total pull request authors: 4
  • Average comments per issue: 1.13
  • Average comments per pull request: 0.0
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • clauswilke (4)
  • ghost (2)
  • yhliu2022 (1)
  • awallender (1)
  • AndreMikulec (1)
  • carlmcqueen (1)
  • lmathew78 (1)
  • homeiraazari (1)
  • johnaclouse (1)
  • Stephonomon (1)
  • blackholeboi (1)
  • mnr (1)
  • ResourcefulSquirrel (1)
  • priessdev (1)
  • adamcohen3 (1)
Pull Request Authors
  • gavinrozzi (3)
  • awallender (1)
  • imgbot[bot] (1)
  • nicholasxlee (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • cran 1,293 last-month
  • Total docker downloads: 25
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 12
  • Total maintainers: 1
cran.r-project.org: zipcodeR

Data & Functions for Working with US ZIP Codes

  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 1,293 Last month
  • Docker Downloads: 25
Rankings
Stargazers count: 5.0%
Forks count: 6.3%
Downloads: 12.1%
Average: 15.2%
Dependent repos count: 23.9%
Dependent packages count: 28.7%
Maintainers (1)
Last synced: 11 months ago
conda-forge.org: r-zipcoder
  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 34.0%
Stargazers count: 34.2%
Average: 40.4%
Forks count: 42.2%
Dependent packages count: 51.2%
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • DBI * imports
  • RSQLite * imports
  • curl * imports
  • dplyr * imports
  • httr * imports
  • jsonlite * imports
  • raster * imports
  • rlang * imports
  • stringr * imports
  • tidycensus * imports
  • tidyr * imports
  • covr * suggests
  • knitr * suggests
  • markdown * suggests
  • readr * suggests
  • rmarkdown * suggests
  • testthat >= 3.0.0 suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/upload-artifact main composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.5.0 composite
  • actions/checkout v4 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite