get_xwalk: Load clean geographic crosswalk tables

View source: R/utilities.R

get_xwalkR Documentation

Load clean geographic crosswalk tables

Description

This function provides a curated assortment of standardized geographic crosswalks. Though limited in scope, it provides quick and consistent access to many of the standard crosswalks used in APDE. If there is a common crosswalk missing among the options in list_ref_xwalk(), please let us know by posting a detailed request in a GitHub issue.

If you need less common crosswalks that are not available through this function, please explore the spatial data built into rads.data, e.g., rads.data::spatial_geocomp_blk10_kps. These rads.data tables were created by many people over many years so you should expect to invest some time in exploration and data harmonization to prepare your two columns of interest.

Usage

get_xwalk(geo1 = NA, geo2 = NA)

Arguments

geo1

character vector of length 1 defining one half of the crosswalk desired, e.g., geo1 = 'zip'

geo2

character vector of length 1 defining the other half of the crosswalk desired, e.g., geo1 = 'city'

Details

A list of all acceptable geographic pairings can be found by typing list_ref_xwalk().

Note that the pairings given as arguments to this function are critical but the order is not. In other words, get_xwalk(geo1 = 'zip', geo2 = 'city') will return the same table as get_xwalk(geo1 = 'city', geo2 = 'zip').

geo definitions

  • blk1: 2010 Census Block. 15 digit Census GEOID (e.g., 530330110012006).

    • 1-2: State (53 = WA)

    • 3-5: County (033 = King County)

    • 6-11: Tract (011001)

    • 12: Block group (2)

    • 12-15: Block (2006)

  • ccd10: 2010 Seattle City Council Districts

  • city: King County cities

  • coo10: 2010 COO places.

  • hra10: 2010 Health Reporting Areas

  • kc: King County

  • kccd10: 2010 King County Council Districts

  • lgd10: 2010 WA State legislative districts

  • puma10: 2010 Public Use Microdata Areas

  • region10: King County regions (North, South, East, & Seattle)

  • scd10: 2010 King County school districts

  • sea10: Seattle or KC except Seattle

  • tract10: 2010 Census Tract. 11 digit Census GEOID.

  • zip: Zip codes in King County.

    • Note! This is different from the 133 zip codes used with HCA data. To view the latter, please type rads.data::spatial_zip_hca.

A note about error propagation!

If you're merging the crosswalk table onto line level data, you can use rads::calc, or data.table, or whatever package you like for further analysis. However, if you're merging on to pre-aggregated data, to further collapse/aggregate/sum, you'll need to properly account for error propagation. Here is a line of data.table code as an example:

DT[, list(estimate = sum(estimate), stderror = sqrt(sum(stderror)^2)), c(group_by_vars)]

Value

a data.table with two columns of geographic identifiers

Examples


 myxwalk <- get_xwalk(geo1 = 'zip', geo2 = 'city')
 myxwalk[]


PHSKC-APDE/rads documentation built on April 14, 2025, 10:47 a.m.