Generate decennial estimates for multiple tables by tracts, counties, MSAs, or places.

get_decennial_recs(
  geography,
  counties = c("King", "Kitsap", "Pierce", "Snohomish"),
  table_codes,
  year,
  fips = NULL
)

Arguments

geography

A character string as either 'tract', 'county', 'msa', or 'place'.

counties

A character string or vector of counties. Defaults to PSRC counties.

table_codes

A character string or vector of Census table codes.

year

Numeric. A decennial year equal or greater than 2010.

fips

Character. Single code or vector of either MSA or place fips codes.

Value

a tibble of decennial estimates by selected geography for selected table codes. Includes variable names.

Author

Christy Lam

Examples

Sys.getenv("CENSUS_API_KEY")
#> [1] "325779a5606507b511316d1ecd4328aa21cfc70d"
tbl_names <- paste0('PCT020', LETTERS[1:6])
get_decennial_recs(geography = 'county', table_codes = tbl_names, year = 2010)
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020A. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020A. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020A. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020A. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020B. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020B. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020B. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020B. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020C. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020C. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020C. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020C. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020D. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020D. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020D. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020D. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020E. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020E. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020E. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020E. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020F. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020F. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020F. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020F. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> # A tibble: 768 × 6
#>    GEOID NAME                    variable   value label                  concept
#>    <chr> <chr>                   <chr>      <dbl> <chr>                  <chr>  
#>  1 53033 King County, Washington PCT020A001 24629 Total                  GROUP …
#>  2 53033 King County, Washington PCT020A002  7394 Total!!Institutionali… GROUP …
#>  3 53033 King County, Washington PCT020A003  1977 Total!!Institutionali… GROUP …
#>  4 53033 King County, Washington PCT020A004   392 Total!!Institutionali… GROUP …
#>  5 53033 King County, Washington PCT020A005     0 Total!!Institutionali… GROUP …
#>  6 53033 King County, Washington PCT020A006     0 Total!!Institutionali… GROUP …
#>  7 53033 King County, Washington PCT020A007  1287 Total!!Institutionali… GROUP …
#>  8 53033 King County, Washington PCT020A008   298 Total!!Institutionali… GROUP …
#>  9 53033 King County, Washington PCT020A009     0 Total!!Institutionali… GROUP …
#> 10 53033 King County, Washington PCT020A010   251 Total!!Institutionali… GROUP …
#> # ℹ 758 more rows

get_decennial_recs(geography = 'tract', table_codes = tbl_names, year = 2010)
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020A. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020A. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020A. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020A. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020B. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020B. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020B. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020B. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020C. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020C. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020C. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020C. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020D. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020D. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020D. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020D. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020E. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020E. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020E. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020E. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020F. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020F. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020F. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT020F. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> # A tibble: 148,992 × 6
#>    GEOID       NAME                                 variable value label concept
#>    <chr>       <chr>                                <chr>    <dbl> <chr> <chr>  
#>  1 53033000100 Census Tract 1, King County, Washin… PCT020A…    32 Total GROUP …
#>  2 53033000200 Census Tract 2, King County, Washin… PCT020A…    55 Total GROUP …
#>  3 53033000300 Census Tract 3, King County, Washin… PCT020A…     8 Total GROUP …
#>  4 53033000401 Census Tract 4.01, King County, Was… PCT020A…    97 Total GROUP …
#>  5 53033000402 Census Tract 4.02, King County, Was… PCT020A…   247 Total GROUP …
#>  6 53033000500 Census Tract 5, King County, Washin… PCT020A…    17 Total GROUP …
#>  7 53033000600 Census Tract 6, King County, Washin… PCT020A…    34 Total GROUP …
#>  8 53033000700 Census Tract 7, King County, Washin… PCT020A…     9 Total GROUP …
#>  9 53033000800 Census Tract 8, King County, Washin… PCT020A…    52 Total GROUP …
#> 10 53033000900 Census Tract 9, King County, Washin… PCT020A…    13 Total GROUP …
#> # ℹ 148,982 more rows

get_decennial_recs(geography = 'place',
                   table_codes = 'PCT013',
                   year = 2010,
                   fips = c("5363000", "5308850"))
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table PCT013. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Using Census Summary File 1
#> # A tibble: 98 × 6
#>    GEOID   NAME                     variable   value label               concept
#>    <chr>   <chr>                    <chr>      <dbl> <chr>               <chr>  
#>  1 5308850 Burien city, Washington  PCT013001  33013 Total               SEX BY…
#>  2 5363000 Seattle city, Washington PCT013001 583735 Total               SEX BY…
#>  3 5308850 Burien city, Washington  PCT013002  16612 Total!!Male         SEX BY…
#>  4 5363000 Seattle city, Washington PCT013002 290243 Total!!Male         SEX BY…
#>  5 5308850 Burien city, Washington  PCT013003   1140 Total!!Male!!Under… SEX BY…
#>  6 5363000 Seattle city, Washington PCT013003  16424 Total!!Male!!Under… SEX BY…
#>  7 5308850 Burien city, Washington  PCT013004   1065 Total!!Male!!5 to … SEX BY…
#>  8 5363000 Seattle city, Washington PCT013004  12919 Total!!Male!!5 to … SEX BY…
#>  9 5308850 Burien city, Washington  PCT013005    947 Total!!Male!!10 to… SEX BY…
#> 10 5363000 Seattle city, Washington PCT013005  10989 Total!!Male!!10 to… SEX BY…
#> # ℹ 88 more rows

get_decennial_recs(geography = 'msa',
                   table_codes = c("H001", "P001"),
                   year = 2010,
                   fips = c('42660', "28420"))
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table H001. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table P001. To cache this dataset for faster access to Census tables in the future, run this function with `cache_table = TRUE`. You only need to do this once per Census dataset.
#> Using Census Summary File 1
#> # A tibble: 4 × 6
#>   GEOID NAME                                    variable   value label concept  
#>   <chr> <chr>                                   <chr>      <dbl> <chr> <chr>    
#> 1 28420 Kennewick-Pasco-Richland, WA Metro Area H001001    93041 Total HOUSING …
#> 2 42660 Seattle-Tacoma-Bellevue, WA Metro Area  H001001  1463295 Total HOUSING …
#> 3 28420 Kennewick-Pasco-Richland, WA Metro Area P001001   253340 Total TOTAL PO…
#> 4 42660 Seattle-Tacoma-Bellevue, WA Metro Area  P001001  3439809 Total TOTAL PO…