The data comes from the American Community Survey (ACS). The variables are: total population, percent White not Hispanic, Percent Black or African American not Hispanic, percent Asian not Hispanic, percent Hispanic all races, per-capita income, median rent and median age.

get_county_demographics(endyear = 2013, span = 5)

Arguments

endyear

The end year for the survey

span

The span of the survey

References

The choroplethr guide to Census data: http://www.arilamstein.com/open-source/choroplethr/mapping-us-census-data/

A list of all ACS Surveys: http://factfinder.census.gov/faces/affhelp/jsf/pages/metadata.xhtml?lang=en&type=survey&id=survey.en.ACS_ACS

Examples

# get some demographic data on US counties from the 2010 5-year ACS df = get_county_demographics(endyear=2010, span=5)
#> Warning: No data found at: #> https://api.census.gov/data/2010/acs5?key=f8b2a6df01479981aef39577b3c4466f5a4c8274&get=B03002_001E,B03002_001M,B03002_002E,B03002_002M,B03002_003E,B03002_003M,B03002_004E,B03002_004M,B03002_005E,B03002_005M,B03002_006E,B03002_006M,B03002_007E,B03002_007M,B03002_008E,B03002_008M,B03002_009E,B03002_009M,B03002_010E,B03002_010M,B03002_011E,B03002_011M,B03002_012E,B03002_012M,B03002_013E,B03002_013M,B03002_014E,B03002_014M,B03002_015E,B03002_015M,B03002_016E,B03002_016M,B03002_017E,B03002_017M,B03002_018E,B03002_018M,B03002_019E,B03002_019M,NAME&for=county:*&in=state:*
#> Error in file(file, "rt"): cannot open the connection to 'https://api.census.gov/data/2010/acs5?key=f8b2a6df01479981aef39577b3c4466f5a4c8274&get=B03002_001E,B03002_001M,B03002_002E,B03002_002M,B03002_003E,B03002_003M,B03002_004E,B03002_004M,B03002_005E,B03002_005M,B03002_006E,B03002_006M,B03002_007E,B03002_007M,B03002_008E,B03002_008M,B03002_009E,B03002_009M,B03002_010E,B03002_010M,B03002_011E,B03002_011M,B03002_012E,B03002_012M,B03002_013E,B03002_013M,B03002_014E,B03002_014M,B03002_015E,B03002_015M,B03002_016E,B03002_016M,B03002_017E,B03002_017M,B03002_018E,B03002_018M,B03002_019E,B03002_019M,NAME&for=county:*&in=state:*'
#> NULL
# analyze the percent of people who are white not hispanic # a boxplot shows the distribution boxplot(df$percent_white)
#> Error in df$percent_white: object of type 'closure' is not subsettable
# a choropleth map shows the location of the values # set the 'value' column to be the column we want to render df$value = df$percent_white
#> Error in df$percent_white: object of type 'closure' is not subsettable
#> Error in super$initialize(map.df, user.df): is.data.frame(user.df) is not TRUE