zip_distance: Calculate the distance between two ZIP codes in miles

View source: R/zip_helper_functions.R

zip_distanceR Documentation

Calculate the distance between two ZIP codes in miles

Description

Calculate the distance between two ZIP codes in miles

Usage

zip_distance(zipcode_a, zipcode_b, lonlat = TRUE, units = "miles")

Arguments

zipcode_a

First vector of ZIP codes

zipcode_b

Second vector of ZIP codes

lonlat

lonlat argument to pass to raster::pointDistance() to select method of distance calculation. Default is TRUE to calculate distance over a spherical projection. FALSE will calculate the distance in Euclidean (planar) space.

units

Specify which units to return distance calculations in. Choices include meters or miles.

Value

a data.frame containing a column for each ZIP code and a new column containing the distance between the two columns of ZIP code

Examples

zip_distance("08731", "08901")


gavinrozzi/zipcodeR documentation built on Feb. 16, 2024, 11:29 p.m.