Description Usage Arguments Details See Also Examples
View source: R/census_API_functions.R
Query data from US Census Bureau API and collect result into dplyr data frame
1 | runCensusAPIQueries(data_url, key, vars, region, numeric = TRUE)
|
data_url |
The url root of the api including the '?' |
key |
API key |
vars |
A character vector of variable names |
region |
A region specification containing a 'for:' and possibly an 'in:' |
For information on the US Census API see https://www.census.gov/developers/.
This function is a modified version of the code published here: http://rstudio-pubs-static.s3.amazonaws.com/19337_2e7f827190514c569ea136db788ce850.html
Other census functions: queryCensusAPI
,
statePop
, vecToChunk
1 2 3 4 5 6 | runCensusAPIQueries(
data_url = "https://api.census.gov/data/2017/acs/acs5?",
key = rstudioapi::askForSecret("censusKey"),
vars = paste0("B01001_", str_pad(2:49, 3, pad = "0"), "E"),
region = "for=county:*&in=state:31"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.