Learn R Programming

zctaCrosswalk (version 2.0.0)

get_zctas_by_county: Return the ZCTAs in a vector of counties

Description

Given a vector of counties, return the ZIP Code Tabulation Areas (ZCTAs) in those counties. Note counties must be identified by FIPS code (character or numeric) in this function because county names are not unique between states. For example, 30 states have a county named "Washington".

Usage

get_zctas_by_county(counties)

Value

A vector, where each element is a ZCTA in the requested county.

Arguments

counties

A vector of Counties. Must be by FIPS code (numeric or character).

Examples

Run this code
# "06075" is San Francisco County, California
get_zctas_by_county("06075")

# 6075 (== as.numeric("06075")) works too
get_zctas_by_county(6075)

# Multiple counties at the same time are also OK
get_zctas_by_county(c("06075", "36059"))

Run the code above in your browser using DataLab