Generate decennial estimates for multiple tables by MSA(s).

get_decennial_msa(table_codes, year, fips = NULL)

Arguments

table_codes

A character string or vector of Census table codes.

year

Numeric value. A decennial year equal or greater than 2010

fips

Character value. Single code or vector of MSA fips codes.

Value

a tibble of decennial estimates by MSA(s) for selected table codes. Does not include variable names.

Author

Christy Lam

Examples

Sys.getenv("CENSUS_API_KEY")
#> [1] "325779a5606507b511316d1ecd4328aa21cfc70d"
get_decennial_msa(table_codes = c("H001"), year = 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 Census Summary File 1
#> # A tibble: 955 × 4
#>    GEOID NAME                                        variable  value
#>    <chr> <chr>                                       <chr>     <dbl>
#>  1 31540 Madison, WI Metro Area                      H001001  252878
#>  2 31580 Madisonville, KY Micro Area                 H001001   21180
#>  3 36820 Oskaloosa, IA Micro Area                    H001001    9766
#>  4 36860 Ottawa-Streator, IL Micro Area              H001001   68772
#>  5 36900 Ottumwa, IA Micro Area                      H001001   16098
#>  6 36940 Owatonna, MN Micro Area                     H001001   15343
#>  7 36980 Owensboro, KY Metro Area                    H001001   49450
#>  8 37020 Owosso, MI Micro Area                       H001001   30319
#>  9 37060 Oxford, MS Micro Area                       H001001   22729
#> 10 37100 Oxnard-Thousand Oaks-Ventura, CA Metro Area H001001  281695
#> # ℹ 945 more rows

get_decennial_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 × 4
#>   GEOID NAME                                    variable   value
#>   <chr> <chr>                                   <chr>      <dbl>
#> 1 28420 Kennewick-Pasco-Richland, WA Metro Area H001001    93041
#> 2 42660 Seattle-Tacoma-Bellevue, WA Metro Area  H001001  1463295
#> 3 28420 Kennewick-Pasco-Richland, WA Metro Area P001001   253340
#> 4 42660 Seattle-Tacoma-Bellevue, WA Metro Area  P001001  3439809

get_decennial_msa(table_codes = c("H001"), year = 2010, fips = c('42660'))
#> 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
#> # A tibble: 1 × 4
#>   GEOID NAME                                   variable   value
#>   <chr> <chr>                                  <chr>      <dbl>
#> 1 42660 Seattle-Tacoma-Bellevue, WA Metro Area H001001  1463295