Decennial Estimates
get_decennial_recs.Rd
Generate decennial estimates for multiple tables by tracts, counties, MSAs, or places. Currently only working for SF1 tables.
Usage
get_decennial_recs(
geography,
counties = c("King", "Kitsap", "Pierce", "Snohomish"),
sumfile = "sf1",
years,
variables = NULL,
table_codes = NULL,
fips = NULL
)
Arguments
- geography
A character string as either 'tract', 'county', 'block group', 'msa', or 'place'.
- counties
A character string or vector of counties. Defaults to PSRC counties.
- sumfile
A character string for which summary file to use such as "sf1" or "dp"
- years
Numeric or a vector of numeric years. A decennial year or years equal or greater than 2000.
- variables
A character string or vector of Census variables
- table_codes
A character string or vector of Census table codes, the table code will be padded with 0s such as "H001", as opposed to "H1"
- 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.
Examples
tbl_names <- paste0('PCT020', LETTERS[1:6])
get_decennial_recs(geography = 'county', table_codes = tbl_names, years = 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> Using Census Summary File 1
#> # A tibble: 160 × 8
#> GEOID NAME variable value county year label concept
#> <chr> <chr> <chr> <dbl> <chr> <dbl> <chr> <chr>
#> 1 53033 King County, Washington PCT020F0… 972 53033 2010 Total GROUP …
#> 2 53035 Kitsap County, Washington PCT020F0… 208 53035 2010 Total GROUP …
#> 3 53053 Pierce County, Washington PCT020F0… 381 53053 2010 Total GROUP …
#> 4 53061 Snohomish County, Washington PCT020F0… 132 53061 2010 Total GROUP …
#> 5 53033 King County, Washington PCT020F0… 233 53033 2010 Tota… GROUP …
#> 6 53035 Kitsap County, Washington PCT020F0… 7 53035 2010 Tota… GROUP …
#> 7 53053 Pierce County, Washington PCT020F0… 208 53053 2010 Tota… GROUP …
#> 8 53061 Snohomish County, Washington PCT020F0… 52 53061 2010 Tota… GROUP …
#> 9 53033 King County, Washington PCT020F0… 171 53033 2010 Tota… GROUP …
#> 10 53035 Kitsap County, Washington PCT020F0… 2 53035 2010 Tota… GROUP …
#> # ℹ 150 more rows
get_decennial_recs(geography = 'county', table_codes = 'P001', years = c(2000, 2010))
#> Getting data from the 2000 decennial Census
#> Loading SF1 variables for 2000 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> Using Census Summary File 1
#>
#> Concept for table codes may differ across Census years. Please double check with tidycensus::load_variables()
#> # A tibble: 10 × 8
#> GEOID NAME variable value county year label concept
#> <chr> <chr> <chr> <dbl> <chr> <dbl> <chr> <chr>
#> 1 53033 King County, Washington P001001 1.93e6 53033 2010 Total TOTAL …
#> 2 53035 Kitsap County, Washington P001001 2.51e5 53035 2010 Total TOTAL …
#> 3 53053 Pierce County, Washington P001001 7.95e5 53053 2010 Total TOTAL …
#> 4 53061 Snohomish County, Washingt… P001001 7.13e5 53061 2010 Total TOTAL …
#> 5 REGION Region P001001 3.69e6 NA 2010 Total TOTAL …
#> 6 53033 King County, Washington P001001 1.74e6 53033 2000 Total TOTAL …
#> 7 53035 Kitsap County, Washington P001001 2.32e5 53035 2000 Total TOTAL …
#> 8 53053 Pierce County, Washington P001001 7.01e5 53053 2000 Total TOTAL …
#> 9 53061 Snohomish County, Washingt… P001001 6.06e5 53061 2000 Total TOTAL …
#> 10 REGION Region P001001 3.28e6 NA 2000 Total TOTAL …
get_decennial_recs(geography = 'tract', table_codes = tbl_names, years = 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> Using Census Summary File 1
#> # A tibble: 24,832 × 8
#> GEOID NAME variable value county year label concept
#> <chr> <chr> <chr> <dbl> <chr> <dbl> <chr> <chr>
#> 1 53033000100 Census Tract 1, King C… PCT020F… 0 53033 2010 Total GROUP …
#> 2 53033000200 Census Tract 2, King C… PCT020F… 0 53033 2010 Total GROUP …
#> 3 53033000300 Census Tract 3, King C… PCT020F… 0 53033 2010 Total GROUP …
#> 4 53033000401 Census Tract 4.01, Kin… PCT020F… 0 53033 2010 Total GROUP …
#> 5 53033000402 Census Tract 4.02, Kin… PCT020F… 1 53033 2010 Total GROUP …
#> 6 53033000500 Census Tract 5, King C… PCT020F… 0 53033 2010 Total GROUP …
#> 7 53033000600 Census Tract 6, King C… PCT020F… 0 53033 2010 Total GROUP …
#> 8 53033000700 Census Tract 7, King C… PCT020F… 1 53033 2010 Total GROUP …
#> 9 53033000800 Census Tract 8, King C… PCT020F… 0 53033 2010 Total GROUP …
#> 10 53033000900 Census Tract 9, King C… PCT020F… 0 53033 2010 Total GROUP …
#> # ℹ 24,822 more rows
get_decennial_recs(geography = 'place',
table_codes = 'PCT013',
years = 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 FIPS code '53' for state 'WA'
#> Using Census Summary File 1
#> Using FIPS code '53' for state 'WA'
#> Using Census Summary File 1
#> # A tibble: 98 × 7
#> GEOID NAME variable value year label concept
#> <chr> <chr> <chr> <dbl> <dbl> <chr> <chr>
#> 1 5308850 Burien city, Washington PCT013001 33013 2010 Total SEX BY…
#> 2 5363000 Seattle city, Washington PCT013001 583735 2010 Total SEX BY…
#> 3 5308850 Burien city, Washington PCT013002 16612 2010 Total!!Male SEX BY…
#> 4 5363000 Seattle city, Washington PCT013002 290243 2010 Total!!Male SEX BY…
#> 5 5308850 Burien city, Washington PCT013003 1140 2010 Total!!Male!… SEX BY…
#> 6 5363000 Seattle city, Washington PCT013003 16424 2010 Total!!Male!… SEX BY…
#> 7 5308850 Burien city, Washington PCT013004 1065 2010 Total!!Male!… SEX BY…
#> 8 5363000 Seattle city, Washington PCT013004 12919 2010 Total!!Male!… SEX BY…
#> 9 5308850 Burien city, Washington PCT013005 947 2010 Total!!Male!… SEX BY…
#> 10 5363000 Seattle city, Washington PCT013005 10989 2010 Total!!Male!… SEX BY…
#> # ℹ 88 more rows
get_decennial_recs(geography = 'msa',
table_codes = c("H001", "P001"),
years = c(2000, 2010),
fips = c('42660', "28420"))
#> Getting data from the 2000 decennial Census
#> Loading SF1 variables for 2000 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.
#> Error : Your API call has errors. The API message returned is error: unknown/unsupported geography heirarchy.
#> Variables not found in Summary File 1. Trying Summary File 3...
#> [1] "API error, the year 2000 requested may not be available."
#> Getting data from the 2000 decennial Census
#> Loading SF1 variables for 2000 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.
#> Error : Your API call has errors. The API message returned is error: unknown/unsupported geography heirarchy.
#> Variables not found in Summary File 1. Trying Summary File 3...
#> [1] "API error, the year 2000 requested may not be available."
#> 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
#>
#> Concept for table codes may differ across Census years. Please double check with tidycensus::load_variables()
#> # 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 …
get_decennial_recs(geography = 'block group',
table_codes = c('H001', 'H006'),
years = 2010)
#> 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> Using Census Summary File 1
#> Getting data from the 2010 decennial Census
#> Loading SF1 variables for 2010 from table H006. 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 FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> Using Census Summary File 1
#> # A tibble: 21,176 × 8
#> GEOID NAME variable value county year label concept
#> <chr> <chr> <chr> <dbl> <chr> <dbl> <chr> <chr>
#> 1 530330001001 Block Group 1, Census… H006001 528 53033 2010 Total RACE O…
#> 2 530330001002 Block Group 2, Census… H006001 591 53033 2010 Total RACE O…
#> 3 530330001003 Block Group 3, Census… H006001 691 53033 2010 Total RACE O…
#> 4 530330001004 Block Group 4, Census… H006001 769 53033 2010 Total RACE O…
#> 5 530330001005 Block Group 5, Census… H006001 567 53033 2010 Total RACE O…
#> 6 530330002001 Block Group 1, Census… H006001 429 53033 2010 Total RACE O…
#> 7 530330002002 Block Group 2, Census… H006001 552 53033 2010 Total RACE O…
#> 8 530330002003 Block Group 3, Census… H006001 781 53033 2010 Total RACE O…
#> 9 530330002004 Block Group 4, Census… H006001 541 53033 2010 Total RACE O…
#> 10 530330002005 Block Group 5, Census… H006001 669 53033 2010 Total RACE O…
#> # ℹ 21,166 more rows
get_decennial_recs(geography="tract",
variables="DP1_0092C",
years=2020, sumfile="dp")
#> Getting data from the 2020 decennial Census
#> Using FIPS code '53' for state 'WA'
#> Using FIPS code '033' for 'King County'
#> Using FIPS code '035' for 'Kitsap County'
#> Using FIPS code '053' for 'Pierce County'
#> Using FIPS code '061' for 'Snohomish County'
#> Using the Demographic Profile
#> # A tibble: 923 × 8
#> GEOID NAME variable value county year label concept
#> <chr> <chr> <chr> <dbl> <chr> <dbl> <chr> <chr>
#> 1 53033000101 Census Tract 1.01; Kin… DP1_009… 3759 53033 2020 Coun… PROFIL…
#> 2 53033000102 Census Tract 1.02; Kin… DP1_009… 4321 53033 2020 Coun… PROFIL…
#> 3 53033000201 Census Tract 2.01; Kin… DP1_009… 4416 53033 2020 Coun… PROFIL…
#> 4 53033000202 Census Tract 2.02; Kin… DP1_009… 4099 53033 2020 Coun… PROFIL…
#> 5 53033000300 Census Tract 3; King C… DP1_009… 2820 53033 2020 Coun… PROFIL…
#> 6 53033000402 Census Tract 4.02; Kin… DP1_009… 5174 53033 2020 Coun… PROFIL…
#> 7 53033000403 Census Tract 4.03; Kin… DP1_009… 3074 53033 2020 Coun… PROFIL…
#> 8 53033000404 Census Tract 4.04; Kin… DP1_009… 4067 53033 2020 Coun… PROFIL…
#> 9 53033000500 Census Tract 5; King C… DP1_009… 3400 53033 2020 Coun… PROFIL…
#> 10 53033000601 Census Tract 6.01; Kin… DP1_009… 4074 53033 2020 Coun… PROFIL…
#> # ℹ 913 more rows