fetch_all: Grab all the 3-digit origin-destination pairs.

Description Usage Arguments Details Value See Also Examples

Description

Grab all the 3-digit origin-destination pairs.

Usage

1
2
3
fetch_all(origins = all_possible_origins, write_to = NULL,
  sleep_time = 1, n_tries = 3, as_range = FALSE,
  show_details = FALSE, verbose = TRUE)

Arguments

origins

A vector of origin zips. Defaults to all possible origin zips from 000 to 999.

write_to

The path to a CSV file to create and append each result to.

sleep_time

How long to sleep in between requests, plus or minus runif(1) second.

n_tries

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

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?

verbose

Message what's going on?

Details

For all the 3-digit origin zip codes, grab all destination zips and their corresponding zones. This is equivalent to running fetch_zones_three_digit for all possible 3 digit origin zips.

If this fails partway through, origins that could not be retrieved get a "no_success" value in their dest_zip and zone columns but we continue trying to grab results for all supplied origins.

Value

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

See Also

fetch_zones_three_digit

Examples

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

fetch_all(sample(all_possible_origins, 4))

fetch_all(show_details = TRUE, verbose = TRUE,
    write_to = glue::glue(here::here("data", "{Sys.Date()}_zip_zones.csv")))

## End(Not run)

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