Learn R Programming

choroplethr (version 4.0.0)

get_tract_demographics: Get a handful of demographic variables on Census Tracts in a State from the US Census Bureau as a data.frame.

Description

The data comes from the American Community Survey (ACS). The variables are total population and median household income.

Usage

get_tract_demographics(
  state_name,
  county_fips = NULL,
  endyear = 2013,
  span = 5
)

Arguments

state_name

The name of the state. See ?state.regions for proper spelling and capitalization.

county_fips

An optional vector of county fips codes within the state. Useful to set because getting data on all tracts can be slow.

endyear

The end year for the survey

span

The span of the survey

Examples

Run this code
# \donttest{
# 36061 is the FIPS code for Manhatttan (technically "New York County"), NY.
df = get_tract_demographics("new york", 36061)
df$value = df$median_hh_income
tract_choropleth(df, "new york", county_zoom = 36061) 
# }

Run the code above in your browser using DataLab