Skip to contents

Retrieves a geographic crosswalk from the IPUMS NHGIS API based on user-specified source and target geographies and years. Use list_nhgis_crosswalks() to view valid parameter combinations.

Usage

get_nhgis_crosswalk(
  source_year,
  source_geography,
  target_year,
  target_geography,
  download_directory,
  use_cache = FALSE,
  api_key = NULL
)

Arguments

source_year

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

source_geography

Character. Source geography name. One of c("block", "block group", "tract").

target_year

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

target_geography

Character. Target geography name. One of c("block", "block group", "tract", "county").

download_directory

File path. Where to download the crosswalk to.

use_cache

FALSE by default. If TRUE, read in an already-downloaded crosswalk stored in the download_directory, if such a file exists.

api_key

Character. NULL by default, in which case the function looks for an IPUMS_API_KEY environment variable.

Value

A data frame containing the crosswalk between the specified geographies.

#' @return A dataframe representing the requested Geocorr22 crosswalk for all 51 states and Puerto Rico. Depending on the desired geographies, 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

weighting_factor

The attribute used to calculate allocation factors

Details

Note: for the moment, this function does not support block group part crosswalks.