- .data
An "input object" that is data.frame or tibble that contains
ZIP Codes to be crosswalked.
- input_var
The column in the input data that contains five-digit ZIP
Codes. If the input is numeric, it will be transformed to character data
and leading zeros will be added.
- zip_source
Required character scalar or data frame; specifies the
source of ZIP Code crosswalk data. This can be one of either "UDS"
(default) or "HUD"
, or a data frame containing a custom dictionary.
- source_var
Character scalar, required when zip_source
is a
data frame containing a custom dictionary; specifies the column name in
the dictionary object that contains ZIP Codes.
- source_result
Character scalar, required when zip_source
is a
data frame containing a custom dictionary; specifies the column name in
the dictionary object that contains ZCTAs, GEOIDs, or other values.
- year
Optional four-digit numeric scalar for year; varies based on source.
For "UDS"
, years 2009 through 2023 are available. For "HUD"
,
years 2010 through 2024 are available. Does not need to be specified when
a custom dictionary is used.
- qtr
Numeric scalar, required when zip_code
is "HUD"
.
Integer value between 1 and 4, representing the quarter of the year.
- target
Character scalar, required when zip_code
is "HUD"
.
Can be one of "TRACT"
, "COUNTY"
, "CBSA"
,
"CBSADIV"
, "CD"
, and "COUNTYSUB"
.
- query
Scalar or vector, required when zip_code
is "HUD"
.
This can be a five-digit numeric or character ZIP Code, a vector of
ZIP Codes, a two-letter character state abbreviation, or "all"
.
- by
Character scalar, required when zip_code
is "HUD"
;
the column name to use for identifying the best match for a given ZIP Code.
This could be either "residential"
, "commercial"
, or "total"
.
- return_max
Logical scalar, required when zip_code
is "HUD"
;
if TRUE
(default), only the geography with the highest proportion
of the ZIP Code type will be returned. If the ZIP Code straddles two states,
two records will be returned. If FALSE
, all records for the ZIP Code
will be returned. Where a tie exists (i.e. two geographies each contain half
of all addresses), the county with the lowest GEOID
value will be
returned.
- key
Optional when zip_code
is "HUD"
. This should be a
character string containing your HUD API key. Alternatively, it can be
stored in your .RProfile
as hud_key
.
- return
Character scalar, specifies the type of output to return. Can be
one of "id"
(default), which appends only the crosswalked value,
or "all"
, which returns the entire crosswalk file appended to
the source data.