Get Data
get-data.Rmd
Get ACS data
Suppose you wish to tabulate ACS one-year 2019 data for estimates of total people by race and ethnicity, as provided in table B03002 by PSRC counties. You would use the following function call:
get_acs_recs(geography = 'county',
table.names = 'B03002',
years = 2019,
acs.type = 'acs1')
## # A tibble: 105 × 14
## GEOID name state variable estimate moe label concept census_geography
## <chr> <chr> <chr> <chr> <dbl> <dbl> <chr> <chr> <chr>
## 1 53033 King Coun… Wash… B03002_… 2252782 NA Esti… HISPAN… County
## 2 53033 King Coun… Wash… B03002_… 2030140 NA Esti… HISPAN… County
## 3 53033 King Coun… Wash… B03002_… 1302544 3208 Esti… HISPAN… County
## 4 53033 King Coun… Wash… B03002_… 147822 4678 Esti… HISPAN… County
## 5 53033 King Coun… Wash… B03002_… 13321 1990 Esti… HISPAN… County
## 6 53033 King Coun… Wash… B03002_… 424590 7085 Esti… HISPAN… County
## 7 53033 King Coun… Wash… B03002_… 15702 1831 Esti… HISPAN… County
## 8 53033 King Coun… Wash… B03002_… 6574 3281 Esti… HISPAN… County
## 9 53033 King Coun… Wash… B03002_… 119587 8804 Esti… HISPAN… County
## 10 53033 King Coun… Wash… B03002_… 2639 1744 Esti… HISPAN… County
## # ℹ 95 more rows
## # ℹ 5 more variables: acs_type <chr>, year <dbl>, se <dbl>, cv <dbl>,
## # reliability <chr>
Default and custom arguments
By default, without specifying any counties, the jurisdictions
returned will be King, Kitsap, Pierce, and Snohomish Counties. Use
?get_acs_recs()
for other default values implemented in
this function.
To retrieve non-PSRC counties or a subset of the default counties,
use the counties
argument and provide a vector of counties
(e.g. counties = c("King", "Thurston")
). Do not use the
fips
argument as that is reserved for MSA or place
geographies.
Get Census data
The get_decennial_recs()
to generate Decennial Census
tables operates similarly to the get_acs_recs()
. If you
wanted to retrieve housing units and total population by MSA, you would
call the following:
get_decennial_recs(geography = 'msa',
table_codes = c("H001", "P001"),
years = c(2010),
fips = c('42660', "28420"))
## # A tibble: 4 × 7
## GEOID NAME variable value year label concept
## <chr> <chr> <chr> <dbl> <dbl> <chr> <chr>
## 1 28420 Kennewick-Pasco-Richland, WA Metro … H001001 9.30e4 2010 Total HOUSIN…
## 2 42660 Seattle-Tacoma-Bellevue, WA Metro A… H001001 1.46e6 2010 Total HOUSIN…
## 3 28420 Kennewick-Pasco-Richland, WA Metro … P001001 2.53e5 2010 Total TOTAL …
## 4 42660 Seattle-Tacoma-Bellevue, WA Metro A… P001001 3.44e6 2010 Total TOTAL …
Note: the table names are padded with 0s, so you call “H001” as opposed to “H1” as you would in Elmer. Only SF1 tables are currently implemented.