knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
According to (Consolidated Planning/CHAS Data | HUD USER), the United States Department of Housing and Urban Development (HUD) gets custom tabulations of American Community Survey (ACS) data from the United States Census Bureau every year. These figures, dubbed "CHAS" (Comprehensive Housing Affordability Strategy), show the scope of housing issues and needs, particularly among low-income households. Local governments utilize the CHAS data to plan how they will spend HUD monies, and HUD may use the data to distribute grant funds.
These are basic examples showing you how to query the Comprehensive Housing and Affordability (CHAS) API.
Each geoid query represents a CHAS measurement for that particular geographic resolution. Before looking at the examples I RECOMMEND first looking at [the parameters][Parameters] as well as [return data][Returns] located at the bottom of the page. (^ Currently a work in progress ^)
The functions below are the main functions for querying the CHAS API at different geographic resolutions. The package also contains an omni function which encapsulates the capabilities of all the main function calls below -- [omni-function][Using the omni function for querying]
1) [nation][Comprehensive Housing and Affordability Strategy for Nation] 2) [state][Comprehensive Housing and Affordability Strategy for States] 3) [county][Comprehensive Housing and Affordability Strategy for County] 4) [mcd][Comprehensive Housing and Affordability Strategy for MCD] 5) [place][Comprehensive Housing and Affordability Strategy for Place]
library(rhud) hud_chas_nation(year=c("2014-2018"))
# Queries for CHAS in a state hud_chas_state("Maryland", year=c("2012-2016"))
# Queries a county in Virginia hud_chas_county("51999", year=c("2014-2018"))
# Queries for CHAS for all mcds in Virginia hud_chas_state_mcd("VA", year=c("2014-2018"))
# Queries for CHAS for all places in state fips code 51. hud_chas_state_place("51", year=c("2014-2018"))
The omni function requires specifying the type which can be from 1-12. The type argument follows the number scheme described at [Input Arguments][]. You also must use the 'query' argument for inputting geoids instead of the specific geoid names (i.e county = 22031, cd = 7200) used by the other functions.
The input arguments for the omni function closely follow the API arguments provided by HUD USER. Please type in '?hud_chas' into your terminal to get more details on how to use this.
hud_chas(type = 1) hud_chas(type = 2, 51)
This is an example to show you how to query for all counties in MD, Virginia, and California, respectively.
hud_state_counties("MD") hud_state_counties("Virginia") hud_state_counties("6")
This is an example to show you how to query for minor civil divisions in Virginia and California.
hud_state_minor_civil_divisions(c("VA", "CA"))
This is an example to show you how to query for places in Wyoming and Michigan
hud_state_places(c("VA", "CA"))
| "Consolidated Planning/CHAS Data | HUD USER." www.huduser.gov, | www.huduser.gov/portal/datasets/cp.html.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.