call_census_api: Retrieve data from the Census API

Description Usage Arguments Details Value

View source: R/call_census_api.R

Description

Returns Census data for the 2010 SF1 or ACS 2013-2015 1-, 3-, and 5-Yr aggregations for requested variables and geographies.

Usage

1
2
3
call_census_api(variables_to_get, names = NULL, geoids, allgeos = NULL,
  data_source = c("sf1", "acs"), year = 2013, period = 5,
  api_key = NULL)

Arguments

variables_to_get

A character vector of the desired variable names for the Census API call, defined at http://api.census.gov/

names

A character vector of the same length as variables_to_get giving the user-defined names for the variables (optional). Defaults to raw API names.

geoids

A character vector of FIPS codes; must be at least to the county (5-digit) level, and can accept down to blocks (15-digit).

allgeos

(optional) A string identifying the type of geography for which to collect data within the the requested geoids. Must be one of c('co', 'tr', 'bg', 'bl'). For instance, if allgeos = "bg", will return all block groups within the given geoids.

data_source

A string identifying whether the SF1 (decennial census) or ACS data is desired.

year

If data_source = "acs", the final year of the summary period. Default is 2013.

period

If data_source = "acs", the length of aggregation period. Default is 5, or a 5-year aggregation table.

api_key

The user's Census API key (as a character string). You can get a free key from [Census](http://api.census.gov/data/key_signup.html). See vignette('censusr', package = 'censusr') to setup a default key as an environment variable.

Details

See vignette('censusr', package = 'censusr') for examples.

Value

a data_frame with each requested variable at each requested geography.


censusr documentation built on May 19, 2017, 10:27 a.m.

Search within the censusr package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.