get_acs_data: Returns a list representing American Community Survey (ACS)...

View source: R/acs.R

get_acs_dataR Documentation

Returns a list representing American Community Survey (ACS) estimates

Description

Given a map, ACS tableId, endyear and span. Prompts user for the column id if there are multiple tables. The first element of the list is a data.frame with estimates. The second element is the ACS title of the column. Requires the acs package to be installed, and a Census API Key to be set with the acs's api.key.install function. Census API keys can be obtained at http://api.census.gov/data/key_signup.html.

Usage

get_acs_data(
  tableId,
  map,
  endyear = 2012,
  span = 5,
  column_idx = -1,
  include_moe = FALSE
)

Arguments

tableId

The id of an ACS table

map

The map you want to use. Must be one of "state", "county" or "zip".

endyear

The end year of the survey to use. See acs.fetch (?acs.fetch) and http://1.usa.gov/1geFSSj for details.

span

The span of time to use. See acs.fetch and http://1.usa.gov/1geFSSj for details. on the same longitude and latitude map to scale. This variable is only checked when the "states" variable is equal to all 50 states.

column_idx

The optional column id of the table to use. If not specified and the table has multiple columns, you will be prompted for a column id.

include_moe

Whether to include the 90 percent margin of error.

See Also

http://factfinder2.census.gov/faces/help/jsf/pages/metadata.xhtml?lang=en&type=survey&id=survey.en.ACS_ACS, which lists all ACS Surveys.

Examples

## Not run: 
library(Hmisc) # for cut2
# States with greater than 1M residents
df       = get_acs_data("B01003", "state")[[1]] # population
df$value = cut2(df$value, cuts=c(0,1000000,Inf))
state_choropleth(df, title="States with a population over 1M", legend="Population")

# Counties with greater than or greater than 1M residents
df       = get_acs_data("B01003", "county")[[1]] # population
df$value = cut2(df$value, cuts=c(0,1000000,Inf))
county_choropleth(df, title="Counties with a population over 1M", legend="Population")

## End(Not run)

arilamstein/choroplethr documentation built on March 2, 2024, 8:17 p.m.