Learn R Programming

zippeR (version 0.1.0)

zi_load_labels: Load Label Data

Description

This function loads a specific label data set that can be used to label five or three-digit ZIP codes in a data frame.

Usage

zi_load_labels(source = "UDS", type = "zip5", include_scf = FALSE,
    vintage = 2022)

Value

A tibble with the specified label data for either five or three-digit ZIP Codes.

Arguments

source

A required character scalar; specifies the source of the label data. The only supported sources are 'UDS' (default) and 'USPS'.

type

A required character scalar; one of either 'zip3' or 'zip5'. The 'zip3' type is only available from the 'USPS' source, while the 'zip5' type is available from 'UDS'.

include_scf

A logical scalar required when source = 'USPS' and type = 'zip3'; specifying whether to include the SCF (Sectional Center Facility) ID in the output. The default is FALSE.

vintage

A required character or numeric scalar; specifying the date for source = 'USPS' or the year of the data for source = 'UDS'. The zip_load_labels_list() function can be used to see available date values for source = 'USPS'.

Details

Labels are approximations of the actual location of a ZIP Code. For five-digit ZIP Codes, the city and state may or may not correspond to an individuals' mailing address city (since multiple cities may be accepted as valid by USPS for a particular ZIP Code) or state (since ZIP Codes may cross state lines).

For three-digit ZIP Codes, the area and state may or may not correspond to an individuals' mailing address state (since SCFs cover multiple states). For example, the three digit ZIP Code 010 covers Western Massachusetts in practice, but is assigned to the state of Connecticut.

Examples

Run this code
# \donttest{
  # zip5 labels via UDS
  zi_load_labels(source = "UDS", type = "zip5", vintage = 2022)

  # zip3 labels via USPS
  zi_load_labels(source = "USPS", type = "zip3", vintage = 202408)
# }

Run the code above in your browser using DataLab