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.

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

## Arguments

tableId The id of an ACS table The map you want to use. Must be one of "state", "county" or "zip". The end year of the survey to use. See acs.fetch (?acs.fetch) and http://1.usa.gov/1geFSSj for details. 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. 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. Whether to include the 90 percent margin of error.

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

library(Hmisc) # for cut2#> Loading required package: lattice#> Loading required package: survival#> Loading required package: Formula#> Loading required package: ggplot2#>
#> Attaching package: ‘Hmisc’#> The following objects are masked from ‘package:dplyr’:
#>
#>     src, summarize#> The following object is masked from ‘package:testthat’:
#>
#>     describe#> The following objects are masked from ‘package:base’:
#>
#>     format.pval, units# States with greater than 1M residents
df       = get_acs_data("B01003", "state")[[1]] # population#> Warning: No data found at:
#>   https://api.census.gov/data/2012/acs5?key=f8b2a6df01479981aef39577b3c4466f5a4c8274&get=B01003_001E,B01003_001M,NAME&for=state:*#> Error in file(file, "rt"): cannot open the connection to 'https://api.census.gov/data/2012/acs5?key=f8b2a6df01479981aef39577b3c4466f5a4c8274&get=B01003_001E,B01003_001M,NAME&for=state:*'df$value = cut2(df$value, cuts=c(0,1000000,Inf))#> Error in df$value: object of type 'closure' is not subsettablestate_choropleth(df, title="States with a population over 1M", legend="Population")#> Error in super$initialize(map.df, user.df): is.data.frame(user.df) is not TRUE
# Counties with greater than or greater than 1M residents
df       = get_acs_data("B01003", "county")[[1]] # population#> Warning: No data found at:
#>   https://api.census.gov/data/2012/acs5?key=f8b2a6df01479981aef39577b3c4466f5a4c8274&get=B01003_001E,B01003_001M,NAME&for=county:*&in=state:*#> Error in file(file, "rt"): cannot open the connection to 'https://api.census.gov/data/2012/acs5?key=f8b2a6df01479981aef39577b3c4466f5a4c8274&get=B01003_001E,B01003_001M,NAME&for=county:*&in=state:*'df$value = cut2(df$value, cuts=c(0,1000000,Inf))#> Error in df$value: object of type 'closure' is not subsettablecounty_choropleth(df, title="Counties with a population over 1M", legend="Population")#> Error in super$initialize(map.df, user.df): is.data.frame(user.df) is not TRUE