Learn R Programming

zippeR (version 0.1.0)

zi_list_zctas: List ZCTA GEOIDs for States

Description

This function returns a vector of GEOIDs that represent ZCTAs in and around states, depending on the method selected. The two methods included described in Details below.

Usage

zi_list_zctas(year, state, method)

Value

A vector of GEOIDs representing ZCTAs in and around the state selected.

Arguments

year

A four-digit numeric scalar for year. zippeR currently supports data between 2010 and 2021.

state

A scalar or vector with state abbreviations (e.x. "MO") or FIPS codes (e.x. 29).

method

A character scalar - either "intersect" or "centroid". See Details below.

Details

Since ZCTAs cross state lines, two methods are used to create these vectors. The "intersect" method will return ZCTAs that border the state selected. In most cases, this will result in more ZCTAs being returned than are actually within the states(s) named in the state argument. Conversely, the "centroid" method will return only ZCTAs whose centroids (geographical centers) lie within the states named. In most cases, this will return fewer ZCTAs than actually lie within the state selected. Users will need to review their data carefully and, when using other zipperR functions, will likely need to use the include and exclude arguments to finalize the geographies returned.

Examples

Run this code
# Missouri ZCTAs, intersect method
## return list
mo_zctas <- zi_list_zctas(year = 2021, state = "MO", method = "intersect")

## preview ZCTAs
mo_zctas[1:10]

# Missouri ZCTAs, centroid method
## return list
mo_zctas <- zi_list_zctas(year = 2021, state = "MO", method = "centroid")

## preview ZCTAs
mo_zctas[1:10]

Run the code above in your browser using DataLab