acsdata | R Documentation |
acs
).Because downloading the data to compute a proportion, ratio or
aggregation can be slow, the acsdata
function creates an object that
can be used with the sumacs
function. Before using this
function remember to define a key using the acs
command
api.key.install(key="*")
.
acsdata(
formula,
level = "state",
dataset = "acs",
endyear = 2014,
span = 5,
us = "*",
region = "*",
division = "*",
state = "WI",
county = "*",
county.subdivision = "*",
place = "*",
tract = "*",
block.group = "*",
msa = "*",
csa = "*",
necta = "*",
urban.area = "*",
congressional.district = "*",
state.legislative.district.upper = "*",
state.legislative.district.lower = "*",
puma = "*",
zip.code = "*",
american.indian.area = "*",
school.district.elementary = "*",
school.district.secondary = "*",
school.district.unified = "*",
combine = FALSE,
combine.name = "aggregate",
print.levels = TRUE
)
formula |
A character or vector of characters containing formulas using ACS/Census variables. + - operators can be included. / defines a division. |
level |
A character or vector of characters specifying the geographic
level of the data. It may be necessary to specificy values to the
corresponding levels. For instance, when
|
dataset |
A string or vector of strings specifying the data set to be used: acs, sf1 or sf1. The default value is "acs". |
endyear |
An integer or vector of integers (defaults to 2014) indicating the latest year of the data in the survey or Census year. |
span |
An integer indicating the span (in years) of the desired ACS data (should be 1, 3,or 5), defaults to 5. |
combine |
Whether the geographies are to be combined. If |
combine.name |
Label for the aggregate geography when combining levels.
The default value is |
print.levels |
Boolean that print levels generated by the |
Returns a list of ACS objects for different levels to be used with
the sumacs
function.
Depending on the quality of the internet connection, number of variables and levels, getting the ACS data can be slow especially for the levels "county.subdivision", "block.group", and "tract" (it might take more than 30 minutes).
api.key.install(key="*")
# get variables from formula
acsdata("(b16004_004 + b16004_026 + b16004_048 / b16004_001)", level = "county")
# get variables directly
acsdata(c("b16004_004", "b16004_026"), level = "county")
# combine levels
acsdata("(b16004_004 + b16004_026 + b16004_048 / b16004_001)",
level = c("block.group"), state = list("WI"),
county = list(1, 141),
tract = list(950100, 11700),
block.group = list(1:2, 1:2), combine = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.