fetch_zones: Fetch zones for a 3-digit origin zip or an origin-destination...

Description Usage Arguments Details Value Examples

Description

For a given 3-digit origin zip code, grab all destination zips and their corresponding zones.

Usage

1
2
3
fetch_zones(origin_zip = NULL, destination_zip = NULL,
  exact_destination = FALSE, as_range = FALSE, show_details = FALSE,
  n_tries = 3, verbose = FALSE)

Arguments

origin_zip

A single origin zip as character. If > 3 digits and contains leading zeros, make sure to supply as character.

destination_zip

Optional destination zip. If not included, returns all possible destinations for the origin provided. If > 3 digits and contains leading zeros, make sure to supply as character.

exact_destination

If destination_zip is supplied, should the result be filtered to the full destination zip, or its first 3 digits?

as_range

Do you want zones corresponding to a range of destination zips or a full listing of them?

show_details

Should columns with more details be retained?

n_tries

How many times to try getting an origin if we're unsuccessful the first time?

verbose

Message what's going on?

Details

Displays the result of a query to the ["Get Zone Chart"](https://postcalc.usps.com/DomesticZoneChart/) tab. If you just want to supply two 5-digit zips and get a single zone back, use fetch_zones_five_digit.

Value

A tibble with origin zip and destination zips (in ranges or unspooled) and the USPS zones the origin-destination pair corresponds to.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 

a_zip <- fetch_zones("123")
nrow(a_zip)

fetch_zones("123", "456", show_details = TRUE)

(double_oh_seven <- fetch_zones("007", as_range = TRUE))

## End(Not run)

aedobbyn/postal documentation built on May 21, 2019, 6:18 a.m.