Learn R Programming

choroplethr (version 4.0.0)

state_choropleth_acs: Create a US State choropleth from ACS data

Description

Creates a choropleth of US states using the US Census' American Community Survey (ACS) data.

Usage

state_choropleth_acs(
  variable = NULL,
  tableId = NULL,
  column_idx = NULL,
  endyear,
  span = 5,
  title = NULL,
  census_api_key = NULL,
  ...
)

Value

A choropleth.

Arguments

variable

The variable you wish to plot. A list of available census variables can be obtained using tidycensus::load_variables()

tableId

Alternatively, you may specify the ACS table you wish to plot. If the table has more than one variable inside it, you must also specify the index of the column you wish to plot.

column_idx

The index of the desired column within the table.

endyear

The end year of the survey to use.

span

Either 1, 3, or 5, the ACS vintage you wish to use.

title

A title for the plot; if not specified, a title will be assigned based on the variable.

census_api_key

Optional. Census API keys can be obtained at: https://api.census.gov/data/key_signup.html

...

Other arguments passed to state_choropleth; see ?state_choropleth()

Examples

Run this code
# \donttest{
# Create a state choropleth for median household income zooming in 
# on New York, New Jersey and Connecticut
state_choropleth_acs(variable = "B19013_001", endyear = 2011, num_colors=1, 
zoom=c("new york", "new jersey", "connecticut"))
# }

Run the code above in your browser using DataLab