Skip to contents

This function uses fuzzy matching to help identify tables from the census which contain variables of interest. Matched table codes are printed out, along with the Census-provided table description, the parsed variable names, and example table cells. The website https://censusreporter.org/ may also be useful in finding variables.

Usage

cens_find_dec(..., show = 2)

cens_find_acs(..., show = 4)

Arguments

...

Variables to look for. These can be length-1 character vectors, or, for convenience, can be left unquoted (see examples).

show

How many matching tables to show. Increase this to show more possible matches, at the cost of more output. Negative values will be converted to positive but will suppress any printing.

Value

The codes for the top show tables, invisibly if show is positive.

Examples

cens_find_dec("sex", "age")
#> 
#> ── Top 2 matching tables ───────────────────────────────────────────────────────
#> 
#>  P12  - SEX BY AGE
#> Surveys / Files:
#>  Decennial / Summary File 1
#> Parsed variables:
#>sex
#>age
#>race_ethnicity
#> Example values:
#> • male / 67 to 69 years / white alone
#> • female / 65 and 66 years / american indian and alaska native alone
#> • male / 5 to 9 years / hispanic or latino
#> 
#>  PCT12  - SEX BY AGE
#> Surveys / Files:
#>  Decennial / Summary File 1
#> Parsed variables:
#>sex
#>age
#>race_ethnicity
#> Example values:
#> • female / 24 years / american indian and alaska native alone
#> • male / 33 years / hispanic or latino
#> • male / 29 years / two or more races
cens_find_dec(tenure, race)
#> 
#> ── Top 2 matching tables ───────────────────────────────────────────────────────
#> 
#>  H14  - TENURE BY RACE OF HOUSEHOLDER
#> Surveys / Files:
#>  Decennial / Summary File 1
#> Parsed variables:
#>tenure
#>race_of_householder
#> Example values:
#> • owner occupied / householder who is some other race alone
#> • renter occupied / householder who is native hawaiian and other pacific
#> islander alone
#> • owner occupied / householder who is black or african american alone
#> 
#>  H16  - TENURE BY HOUSEHOLD SIZE
#> Surveys / Files:
#>  Decennial / Summary File 1
#> Parsed variables:
#>tenure
#>household_size
#>race_ethnicity
#> Example values:
#> • owner occupied / 3-person household / total
#> • owner occupied / 1-person household / white alone householder
#> • renter occupied / 5-person household / total
cens_find_acs("income", "sex", show=3)
#> 
#> ── Top 3 matching tables ───────────────────────────────────────────────────────
#> 
#>  B17008  - AGGREGATE INCOME DEFICIT (DOLLARS) IN THE PAST 12 MONTHS OF
#> UNRELATED INDIVIDUALS BY SEX
#> Surveys / Files:
#>  ACS / 1-year Detailed
#>  ACS / 5-year Detailed
#> Parsed variables:
#>sex
#> Example values:
#> • female (dollars)
#> • male (dollars)
#> • total
#> 
#>  B19216  - AGGREGATE NONFAMILY HOUSEHOLD INCOME IN THE PAST 12 MONTHS (IN 2019
#> INFLATION-ADJUSTED DOLLARS) BY SEX OF HOUSEHOLDER BY LIVING ALONE BY AGE OF
#> HOUSEHOLDER
#> Surveys / Files:
#>  ACS / 1-year Detailed
#>  ACS / 5-year Detailed
#> Parsed variables:
#>sex_of_householder
#>living_alone
#>age_of_householder
#> Example values:
#> • male householder (dollars) / total / total
#> • male householder (dollars) / living alone (dollars) / total
#> • total / total / total
#> 
#>  B21004  - MEDIAN INCOME IN THE PAST 12 MONTHS (IN 2019 INFLATION-ADJUSTED
#> DOLLARS) BY VETERAN STATUS BY SEX FOR THE CIVILIAN POPULATION 18 YEARS AND OVER
#> WITH INCOME
#> Surveys / Files:
#>  ACS / 1-year Detailed
#>  ACS / 5-year Detailed
#> Parsed variables:
#>veteran_status
#>sex_for_the_civilian_population_18_years_over_with_income
#> Example values:
#> • veteran / total
#> • veteran / male
#> • total / total
cens_find_acs("heath care", show=-1)
#> [1] "B27009"