library(zipcodeR) knitr::opts_chunk$set(echo = TRUE) set.seed(1000)
{zipcodeR}
has introduced several new functions geared towards geographic applications. In this vignette we will explore these new functions and some of their typical use cases with examples.
This version introduces the new function zip_distance()
for calculating the distance between two ZIP codes in miles.
zip_distance('08731','08753')
Users often are seeking to use zipcodeR to geocode ZIP codes. While it is possible to do this already, I have introduced a simple wrapper function that only returns that centroid coordinates of each provided ZIP code to make this process easier.
geocode_zip('08731')
You can also pass a vector of ZIP codes to geocode to quickly geocode ZIP code-level data
geocode_zip(c('08731','08721','08753'))
Given a pair of latitude / longitude coordinates in WGS84 format you can search for all ZIP codes located within a provided radius in miles. This function will default to searching within 1 mile of your provided coordinates, but can be configured to search any arbitrary radius via the radius argument.
The below code searches for all ZIP codes within 20 miles of the
search_radius(39.9, -74.3, radius = 20)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.