Skip to contents

This function queries the Comprehensive Housing Affordability Strategy CHAS API provided by US Department of Housing and Urban Development (HUD USER). This closely follow their API implementation. For more intuitive querying, check the decomposed versions linked below. The ordering of items in stateid input must match that of the entityid input.

Usage

hud_chas(
  type,
  state_id = NULL,
  entity_id = NULL,
  year = c("2014-2018"),
  key = Sys.getenv("HUD_KEY"),
  to_tibble = getOption("rhud_use_tibble", FALSE)
)

Arguments

type

Queries the data based off: 1 - Nation 2 - State 3 - County 4 - MCD 5 - Place

Can either supply the number from 1-5 or the name. Either Nation, State, County, MCD, or Place

state_id

For types 2,3,4,5, you must provide a state_id.

entity_id

For types 3,4,5, you must provide a fips code, placecode, or mcd code.

year

Gets the year that this data was recorded. Defaults to 2014-2018. There are specific year ranges that are only accepted.

  • 2014-2018

  • 2013-2017

  • 2012-2016

  • 2011-2015

  • 2010-2014

  • 2009-2013

  • 2008-2012

  • 2007-2011

  • 2006-2010

key

The key obtained from HUD (US Department of Housing and Urban Development) USER website.

to_tibble

If TRUE, return the data in a tibble format rather than a data frame.

Value

This function returns a dataframe or tibble containing Comprehensive Housing and Affordability Strategy data for a particular state. For more details about these measurements, go to https://www.huduser.gov/portal/dataset/chas-api.html

Examples

if (FALSE) {
hud_chas(1)

hud_chas('2', state_id = '56')

hud_chas('3','51','199')

hud_chas('4', '51', 94087)

hud_chas('5', '51', 48996)
}