Skip to contents

Retrieves a crosswalk with interpolation values from a source geography to a target geography or from a source year to a target year.

Usage

get_crosswalk(
  source_geography,
  target_geography,
  source_year = NULL,
  target_year = NULL,
  cache = NULL,
  weight = NULL
)

Arguments

source_geography

Character. Source geography name. One of c("block", "block group", "tract", "place", county", "urban_area", "zcta", "puma", "cd118", "cd119", "urban_area", "core_based_statistical_area").

target_geography

Character. Target geography name. One of c("block", "block group", "tract", "place", county", "urban_area", "zcta", "puma", "cd118", "cd119", "urban_area", "core_based_statistical_area").

source_year

Character or numeric. Year of the source geography one of c(1990, 2000, 2010, 2020).

target_year

Character or numeric. Year of the target geography, one of c(1990, 2000, 2010, 2020).

cache

Directory path. Where to download the crosswalk to. If NULL (default), crosswalk is returned but not saved to disk.

weight

Character. Weighting variable. One of c("population", "housing", "land").

Value

A data frame containing the crosswalk between the specified geographies. Data are tidy-formatted, with each observation reflecting a unique source-target-weighting factor combination. Note that all (typically two or three) available weighting factors are returned.

A dataframe representing the requested crosswalk for all 51 states and Puerto Rico. Depending on the desired geographies and the source of the crosswalk (Geocorr vs. NHGIS), some fields may not be included.

source_geoid

A unique identifier for the source geography

target_geoid

A unique identifier for the target geography

source_geography_name

The name of the source geography

target_geography_name

The name of the target geography

source_year

The year of the source geography

target_year

The year of the target geography

allocation_factor_source_to_target

The weight to interpolate values from the source geography to the target geography

allocation_factor_target_to_source

The weight to interpolate values from the target geography to the source geography

population_2020

The estimated overlap in population, if applicable

housing_2020

The estimated overlap in housing units, if applicable

land_area_sqmi

The overlap in land area, if applicable

weighting_factor

The attribute used to calculate allocation factors

Details

This function sources crosswalks from Geocorr 2022 and IPUMS NHGIS. Crosswalk weights are from the original sources and have not been modified; this function merely standardizes the format of the returned crosswalks and enables easy programmatic access and cacheing.

Note that an IPUMS NHGIS API key is required to access crosswalks from that source. Use usethis::edit_r_environ(scope = "user") to save your API key to your .Renviron; the name of the key should be "IPUMS_API_KEY". You can obtain a key from: https://account.ipums.org/api_keys.

Examples