fetch_zones_five_digit: Fetch zones for a 5-digit origin origin-destination pair

Description Usage Arguments Details Value See Also Examples

Description

For a given 5-digit origin and destination zip code pair, display the zone number and full response.

Usage

1
2
fetch_zones_five_digit(origin_zip, destination_zip, show_details = FALSE,
  n_tries = 3, verbose = FALSE)

Arguments

origin_zip

(character) A single origin zip as 5-digit character.

destination_zip

(character) Required destination zip as 5-digit character.

show_details

(boolean) Extract extra stuff from the response? Specifically: specific_to_priority_mail, local, same_ndc, and full_response. Get more info with zone_detail_definitions.

n_tries

(numeric) Number times to try the API if at first we don't succeed.

verbose

(boolean) Message what's going on?

Details

Displays the result of a query to the "Get Zone for ZIP Code Pair" tab of the USPS Zone Calc website.

If you want all destinations for a given origin, use fetch_zones_three_digit with the first 3 digits of the origin; there you don't need to supply a destination.

Value

A tibble with origin zip, destination zip and the USPS zone that origin-destination pair corresponds to. If show_details is TRUE, other columns are shown.

See Also

fetch_zones_three_digit

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
fetch_zones_five_digit("90210", "20500")

fetch_zones_five_digit("40360", "09756",
                       show_details = TRUE)

# Supply multiple origins and destinations
purrr::map2_dfr(c("11238", "60647", "80205"),
                c("98109", "02210", "94707"),
      fetch_zones_five_digit)

## End(Not run)

aedobbyn/usps documentation built on May 3, 2019, 4:03 p.m.