View source: R/read_acs1year.R
read_acs1year | R Documentation |
This function retrieves data from summary file of ACS 1-year estimates. In addition to selected geographic headers and table contents, it also returns total population and coordinates of selected geographic areas, as well as summary levels and geographic components.
read_acs1year(
year,
states,
table_contents = NULL,
areas = NULL,
geo_headers = NULL,
summary_level = NULL,
geo_comp = "total",
with_margin = FALSE,
dec_fill = NULL,
show_progress = TRUE
)
year |
year of the estimate |
states |
vector of state abbreviations, such as "IN" and c("MA", "RI"). |
table_contents |
selected references of contents in census tables. Users
can choose a name for each reference, such as in
c("abc = B01001_009", "fff = B00001_001").
Try to make names meaningful. To find the references of table contents
of interest, search with function |
areas |
For metro area, in the format like "New York metro".
For county, city, or town, must use the exact name as those in
|
geo_headers |
vector of references of selected geographci headers to be
included in the return. Search with |
summary_level |
select which summary level to keep, default to keep all.
It takes strings including "state", "county", "county subdivision",
"place", "tract", "block group", and "block" for the most common
levels. It also take code. Search all codes with
|
geo_comp |
select which geographic component to keep, "*" to keep every
geo-component, "total" for "00", "urban" for "01", "urbanized area"
for "04", "urban cluster" for "28", "rural" for "43". Others should
input code, which can be found with function
|
with_margin |
read also margin of error in addition to estimate |
dec_fill |
whether to fill geo_headers codes with data from decennial census. The #' codes in ACS summary file are incomplete. "dec2010" using decennial census 2010 data. |
show_progress |
whether to show progress in fread() |
A data.table of selected data.
## Not run:
# read summary data using areas of selected cities
aaa <- read_acs1year(
year = 2016,
states = c("UT", "RI"),
table_contents = c("male = B01001_002", "female = B01001_026"),
areas = c("Salt Lake City city, UT",
"Providence city, RI",
"PLACE = RI19180"),
summary_level = "place",
with_margin = TRUE
)
# read data using geoheaders - all major counties
bbb <- read_acs1year(
year = 2015,
states = c("UT", "RI"),
table_contents = c("male = B01001_002", "female = B01001_026"),
geo_headers = c("COUNTY"),
summary_level = "county",
with_margin = TRUE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.