# Example masterlist

The Census APIs have over 200 endpoints, covering dozens of different datasets.

    library(censusapi)

To see a current table of every available endpoint, run `listCensusApis`:

    apis <- listCensusApis()
    View(apis)

Here is a list of examples for dozens of the Census’s API endpoints. Read more about discovering an API’s variable and geography options in Getting started with censusapi

## American Community Survey

### ACS Detailed Tables

Get median household income, with associated annotations and margin of error, for census tracts in Alaska.

    acs_income <- getCensus(name = "acs/acs5",
        vintage = 2017,
        vars = c("NAME", "B19013_001E", "B19013_001EA", "B19013_001M", "B19013_001MA"),
        region = "tract:*",
        regionin = "state:02")
    head(acs_income)

state | county | tract | NAME | B19013_001E | B19013_001EA | B19013_001M | B19013_001MA
--- | --- | --- | --- | --- | --- | --- | ---
02 | 261 | 000300 | Census Tract 3, Valdez-Cordova Census Area, Alaska | 89000 | NA | 20435 | NA
02 | 122 | 000600 | Census Tract 6, Kenai Peninsula Borough, Alaska | 58125 | NA | 5725 | NA
02 | 122 | 001100 | Census Tract 11, Kenai Peninsula Borough, Alaska | 69028 | NA | 5941 | NA
02 | 261 | 000100 | Census Tract 1, Valdez-Cordova Census Area, Alaska | 49076 | NA | 7165 | NA
02 | 122 | 000200 | Census Tract 2, Kenai Peninsula Borough, Alaska | 57694 | NA | 6526 | NA
02 | 122 | 000800 | Census Tract 8, Kenai Peninsula Borough, Alaska | 50904 | NA | 3723 | NA

### ACS Subject Tables

Get the percent of people without an internet subscription by income for the five counties of New York City, with associated margins of error:

- overall: `S2801_C02_019E`
- income less $20,000: `S2801_C02_023E`
- income $20,000 to $74,999: `S2801_C02_027E`
- income $75,000 or greater: `S2801_C02_031E`

    acs_subject <- getCensus(name = "acs/acs1/subject",
        vintage = 2017,
        vars = c("NAME", "S2801_C02_019E", "S2801_C02_019M",
                         "S2801_C02_023E", "S2801_C02_023M",
                         "S2801_C02_027E", "S2801_C02_027M",
                         "S2801_C02_031E", "S2801_C02_031M"),
        region = "county:005,047,061,081,085",
        regionin = "state:36")
    head(acs_subject)

state | county | NAME | S2801_C02_019E | S2801_C02_019M | S2801_C02_023E | S2801_C02_023M | S2801_C02_027E | S2801_C02_027M | S2801_C02_031E | S2801_C02_031M
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
36 | 005 | Bronx County, New York | 22.4 | 1.0 | 39.9 | 2.4 | 19.0 | 1.5 | 6.2 | 1.0
36 | 047 | Kings County, New York | 18.8 | 0.6 | 42.6 | 1.8 | 18.9 | 1.1 | 6.0 | 0.6
36 | 061 | New York County, New York | 14.1 | 0.8 | 40.4 | 2.9 | 16.1 | 1.7 | 4.2 | 0.7
36 | 081 | Queens County, New York | 15.6 | 0.7 | 37.0 | 3.0 | 18.4 | 1.3 | 6.0 | 0.6
36 | 085 | Richmond County, New York | 19.1 | 1.5 | 47.6 | 5.1 | 21.6 | 3.5 | 8.8 | 1.8

### ACS Data Profile

    acs_profile <- getCensus(name = "acs/acs1/profile",
        vintage = 2017,
        vars = "group(DP05)",
        region = "region:*")

### ACS Comparison Profiles

Get the mean travel time to work (in minutes) for the past five years.

    acs_comparison <- getCensus(name = "acs/acs1/cprofile",
        vintage = 2017,
        vars = c("NAME", "CP03_2013_025E", "CP03_2014_025E", "CP03_2015_025E", "CP03_2016_025E", "CP03_2017_025E"),
        region = "metropolitan statistical area/micropolitan statistical area:*")
    head(acs_comparison)

metropolitan_statistical_area_micropolitan_statistical_area | NAME | CP03_2013_025E | CP03_2014_025E | CP03_2015_025E | CP03_2016_025E | CP03_2017_025E
--- | --- | --- | --- | --- | --- | ---
10140 | Aberdeen, WA Micro Area | 24.0 | 25.0 | 23.3 | 26.5 | 29.6
10180 | Abilene, TX Metro Area | 16.9 | 17.0 | 15.6 | 19.1 | 18.3
10300 | Adrian, MI Micro Area | 25.4 | 26.8 | 29.6 | 25.3 | 27.7
10380 | Aguadilla-Isabela, PR Metro Area | 26.0 | 24.8 | 25.3 | 23.9 | 25.2
10420 | Akron, OH Metro Area | 23.1 | 22.9 | 24.3 | 22.9 | 23.2
10460 | Alamogordo, NM Micro Area | 18.3 | 18.4 | 17.7 | 20.4 | 17.3

### ACS Migration Flows

American Community Survey Migration Flows documentation

    flows <- getCensus(name = "acs/flows",
        vintage = 2016,
        vars = c("MOVEDIN", "MOVEDOUT", "FULL1_NAME", "FULL2_NAME", "GEOID2"),
        region = "county:001",
        regionin = "state:01")
    head(flows)

state | county | MOVEDIN | MOVEDOUT | FULL1_NAME | FULL2_NAME | GEOID2
--- | --- | --- | --- | --- | --- | ---
01 | 001 | 70 | NA | Autauga County, Alabama | Asia | NA
01 | 001 | 51 | NA | Autauga County, Alabama | Europe | NA
01 | 001 | 36 | 126 | Autauga County, Alabama | Baldwin County, Alabama | 1003
01 | 001 | 4 | 0 | Autauga County, Alabama | Barbour County, Alabama | 1005
01 | 001 | 7 | 135 | Autauga County, Alabama | Bibb County, Alabama | 1007
01 | 001 | 4 | 0 | Autauga County, Alabama | Blount County, Alabama | 1009

### American Community Survey Language Statistics

American Community Survey Language Statistics documentation

Get the number of people in New York state who speak each language.

    languages <- getCensus(name = "language",
        vintage = 2013,
        vars = c("EST", "LAN", "LANLABEL"),
        region = "state:36")
    head(languages)

state | EST | LAN | LANLABEL
--- | --- | --- | ---
36 | 4210 | 601 | Jamaican Creole
36 | 470 | 602 | Krio
36 | 55 | 604 | Pidgin
36 | NA | 605 | Gullah
36 | NA | 606 | Saramacca
36 | 65165 | 607 | German

## Annual Survey of Entrepreneurs

Annual Survey of Entrepreneurs documentation

    ase_csa <- getCensus(name = "ase/csa",
        vintage = 2014,
        vars = c("GEO_TTL", "NAICS2012", "NAICS2012_TTL", "EMPSZFI", "EMPSZFI_TTL", "FIRMPDEMP"),
        region = "us:*")
    head(ase_csa)

us | GEO_TTL | NAICS2012 | NAICS2012_TTL | EMPSZFI | EMPSZFI_TTL | FIRMPDEMP
--- | --- | --- | --- | --- | --- | ---
00 | United States | 00 | Total for all sectors | 001 | All firms | 5437782
00 | United States | 00 | Total for all sectors | 611 | Firms with no employees | 547115
00 | United States | 00 | Total for all sectors | 612 | Firms with 1 to 4 employees | 2768756
00 | United States | 00 | Total for all sectors | 620 | Firms with 5 to 9 employees | 950224
00 | United States | 00 | Total for all sectors | 630 | Firms with 10 to 19 employees | 585516
00 | United States | 00 | Total for all sectors | 641 | Firms with 20 to 49 employees | 376051

    ase_cscb <- getCensus(name = "ase/cscb",
        vintage = 2014,
        vars = c("GEO_TTL", "NAICS2012_TTL", "ASECB", "ASECB_TTL", "SPOUSES", "SPOUSES_TTL", "YEAR",
                         "FIRMPDEMP", "FIRMPDEMP_PCT", "RCPPDEMP", "RCPPDEMP_F", "RCPPDEMP_PCT",
                         "EMP", "EMP_PCT", "PAYANN", "PAYANN_PCT", "FIRMPDEMP_S", "FIRMPDEMP_PCT_S",
                         "RCPPDEMP_S", "RCPPDEMP_PCT_S", "EMP_S", "EMP_PCT_S", "PAYANN_S", "PAYANN_PCT_S"),
        region = "us:*")
    head(ase_cscb)

us | GEO_TTL | NAICS2012_TTL | ASECB | ASECB_TTL | SPOUSES | SPOUSES_TTL | YEAR | FIRMPDEMP | FIRMPDEMP_PCT | RCPPDEMP | RCPPDEMP_F | RCPPDEMP_PCT | EMP | EMP_PCT | PAYANN | PAYANN_PCT | FIRMPDEMP_S | FIRMPDEMP_PCT_S | RCPPDEMP_S | RCPPDEMP_PCT_S | EMP_S | EMP_PCT_S | PAYANN_S | PAYANN_PCT_S
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
00 | United States | Total for all sectors | 0000 | All firms | A1 | All firms | 2014 | 5437782 | 0 | 33036935112 | NA | 0 | 115129295 | 0 | 5640982990 | 0 | 0 | 0 | 0.5 | 0 | 0.3 | 0 | 0.3 | 0
00 | United States | Total for all sectors | 0000 | All firms | LZ | Jointly owned and equally operated by spouses | 2014 | 335149 | 30.6 | 493143589 | NA | 15.4 | 3303608 | 23 | 104343482 | 19.2 | 0.6 | 0.3 | 3.7 | 5.5 | 1.7 | 6.2 | 1.8 | 5.4
00 | United States | Total for all sectors | 0000 | All firms | MA | Jointly owned but primarily operated by male spouse | 2014 | 336310 | 30.7 | 603733952 | NA | 18.8 | 3015332 | 21 | 109460428 | 20.2 | 0.8 | 0.3 | 3.2 | 1.8 | 1.8 | 3.5 | 3 | 3.5
00 | United States | Total for all sectors | 0000 | All firms | MB | Jointly owned but primarily operated by female spouse | 2014 | 96475 | 8.8 | 140228793 | NA | 4.4 | 850573 | 5.9 | 25984506 | 4.8 | 1.9 | 0.2 | 12.6 | 1.1 | 3.6 | 0.6 | 4.7 | 0.3
00 | United States | Total for all sectors | 0000 | All firms | MC | Not jointly owned by spouses | 2014 | 328625 | 30 | 1966858366 | NA | 61.4 | 7222018 | 50.2 | 302838280 | 55.8 | 0.6 | 0.5 | 2.5 | 8.1 | 1.6 | 10.3 | 1.9 | 9
00 | United States | Total for all sectors | 0000 | All firms | MD | Total reporting | 2014 | 1096559 | 100 | 3203964700 | NA | 100 | 14391531 | 100 | 542626696 | 100 | 0.2 | 0 | 1.8 | 0 | 0.9 | 0 | 1.3 | 0

    ase_cscbo <- getCensus(name = "ase/cscbo",
        vintage = 2014,
        vars = c("GEO_TTL", "NAICS2012_TTL", "ASECBO", "ASECBO_TTL", "ACQBUS", "ACQBUS_TTL",
                         "YEAR", "OWNPDEMP", "OWNPDEMP_PCT", "OWNPDEMP_S", "OWNPDEMP_PCT_S"),
        region = "us:*")
    head(ase_cscbo)

us | GEO_TTL | NAICS2012_TTL | ASECBO | ASECBO_TTL | ACQBUS | ACQBUS_TTL | YEAR | OWNPDEMP | OWNPDEMP_PCT | OWNPDEMP_S | OWNPDEMP_PCT_S
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
00 | United States | Total for all sectors | 00 | All owners of respondent firms | CA | Founded or started | 2014 | 4063687 | 70.4 | 0.2 | 0.3
00 | United States | Total for all sectors | 00 | All owners of respondent firms | CB | Purchased | 2014 | 1211902 | 21 | 0.5 | 0.2
00 | United States | Total for all sectors | 00 | All owners of respondent firms | CC | Inherited | 2014 | 227408 | 3.9 | 1.7 | 0.1
00 | United States | Total for all sectors | 00 | All owners of respondent firms | CD | Transfer of ownership or gift | 2014 | 405356 | 7 | 0.6 | 0.1
00 | United States | Total for all sectors | 00 | All owners of respondent firms | CE | Total reporting | 2014 | 5768389 | 100 | 0.2 | 0
00 | United States | Total for all sectors | 00 | All owners of respondent firms | CF | Item not reported | 2014 | 14476 | 0 | 7.3 | 0

## Annual Survey of Manufactures

Annual Survey of Manufactures documentation

    asm_state <- getCensus(name = "timeseries/asm/state",
        vars = c("GEO_TTL", "NAICS_TTL", "EMP"),
        region = "state:*",
        time = 2016,
        naics = "31-33")
    head(asm_state)

time | state | GEO_TTL | NAICS_TTL | EMP | NAICS
--- | --- | --- | --- | --- | ---
2016 | 01 | Alabama | Manufacturing | 234803 | 31-33
2016 | 02 | Alaska | Manufacturing | 12178 | 31-33
2016 | 04 | Arizona | Manufacturing | 136946 | 31-33
2016 | 05 | Arkansas | Manufacturing | 145733 | 31-33
2016 | 06 | California | Manufacturing | 1119896 | 31-33
2016 | 08 | Colorado | Manufacturing | 121069 | 31-33

    asm_product <- getCensus(name = "timeseries/asm/product",
        vars = c("PSCODE_TTL", "GEO_TTL", "PRODVAL"),
        region = "us:*",
        time = 2016,
        pscode = 311111)
    head(asm_product)

time | us | PSCODE_TTL | GEO_TTL | PRODVAL | PSCODE
--- | --- | --- | --- | --- | ---
2016 | 1 | Dog and cat food manufacturing | United States | 22933334 | 311111

## Business Dynamics Statistics

Business Dynamics Statistics documentation

    firms_states <- getCensus(name = "timeseries/bds/firms",
        vars = c("firms", "emp", "fage4"),
        region = "state:*",
        time = 2014)
    head(firms_states)

firms | emp | fage4 | time | state
--- | --- | --- | --- | ---
4224 | 31215 | a | 2014 | 01
956 | 3709 | a | 2014 | 02
7519 | 52198 | a | 2014 | 04
2984 | 19464 | a | 2014 | 05
55434 | 324873 | a | 2014 | 06
9648 | 49369 | a | 2014 | 08

    firms_years <- getCensus(name = "timeseries/bds/firms",
        vars = c("firms", "emp"),
        region = "state:01",
        time = "from 1977 to 2014")
    head(firms_years)

firms | emp | time | state
--- | --- | --- | ---
52371 | 957297 | 1977 | 01
54168 | 1032199 | 1978 | 01
54730 | 1083112 | 1979 | 01
54494 | 1080569 | 1980 | 01
52551 | 1039172 | 1981 | 01
51528 | 1032118 | 1982 | 01

## County Business Patterns and Nonemployer Statistics

County Business Patterns and Nonemployer Statistics documentation

### County Business Patterns

County Business Patterns documentation

Get employment data for the construction industry.

    cbp_2016 <- getCensus(name = "cbp",
     vintage = 2016,
     vars = c("GEO_TTL", "EMP", "ESTAB", "NAICS2012_TTL"),
     region = "state:*",
     naics2012 = 23)
     head(cbp_2016)

state | GEO_TTL | EMP | ESTAB | NAICS2012_TTL | NAICS2012
--- | --- | --- | --- | --- | ---
01 | Alabama | 82327 | 7424 | Construction | 23
02 | Alaska | 17022 | 2521 | Construction | 23
04 | Arizona | 141740 | 11921 | Construction | 23
05 | Arkansas | 45609 | 5293 | Construction | 23
06 | California | 723574 | 71981 | Construction | 23
08 | Colorado | 152325 | 17730 | Construction | 23

Get employment data by state for companies with more than 1,000 employees.

    cbp_2008 <- getCensus(name = "cbp",
                                                vintage = 2008,
                                                vars = c("YEAR", "GEO_TTL", "EMPSZES_TTL", "EMP", "ESTAB", "PAYANN"),
                                                region = "state:*",
                                                EMPSZES = 260)
    head(cbp_2008)

state | YEAR | GEO_TTL | EMPSZES_TTL | EMP | ESTAB | PAYANN | EMPSZES
--- | --- | --- | --- | --- | --- | --- | ---
01 | 2008 | Alabama | Establishments with 1,000 employees or more | 175438 | 96 | 8034522 | 260
02 | 2008 | Alaska | Establishments with 1,000 employees or more | 22598 | 16 | 1469718 | 260
04 | 2008 | Arizona | Establishments with 1,000 employees or more | 301091 | 124 | 17089056 | 260
05 | 2008 | Arkansas | Establishments with 1,000 employees or more | 124452 | 68 | 4796665 | 260
06 | 2008 | California | Establishments with 1,000 employees or more | 1872632 | 797 | 124024587 | 260
08 | 2008 | Colorado | Establishments with 1,000 employees or more | 285608 | 120 | 14946331 | 260

### Zip Codes Business Patterns

Zip Codes Business Patterns documentation

    zbp_2016 <- getCensus(name = "zbp",
     vintage = 2016,
     vars = c("GEO_TTL", "EMP"),
     region = "zipcode:90210")
    head(zbp_2016)

zipcode | GEO_TTL | EMP
--- | --- | ---
90210 | 90210(BEVERLY HILLS,CA) | 37602

### Nonemployer statistics

Nonemployer statistics documentation

    nonemp <- getCensus(name = "nonemp",
     vintage = 2016,
     vars = c("GEO_TTL", "NRCPTOT", "NAICS2012_TTL"),
     region = "state:*",
     naics2012 = 54)
    head(nonemp)

state | GEO_TTL | NRCPTOT | NAICS2012_TTL | NAICS2012
--- | --- | --- | --- | ---
01 | Alabama | 1284130 | Professional, scientific, and technical services | 54
02 | Alaska | 265996 | Professional, scientific, and technical services | 54
04 | Arizona | 2991782 | Professional, scientific, and technical services | 54
05 | Arkansas | 616936 | Professional, scientific, and technical services | 54
06 | California | 28746664 | Professional, scientific, and technical services | 54
08 | Colorado | 3709131 | Professional, scientific, and technical services | 54

## Decennial Census

Decennial Census documentation Total population and housing units for metropolitan/micropolitan statistical areas in 2010.

    data2010 <- getCensus(name = "dec/sf1",
        vintage = 2010,
        vars = c("NAME", "P001001", "H010001"),
        region = "metropolitan statistical area/micropolitan statistical area:*")
    head(data2010)

metropolitan_statistical_area_micropolitan_statistical_area | NAME | P001001 | H010001
--- | --- | --- | ---
31540 | Madison, WI Metro Area | 568593 | 554078
31580 | Madisonville, KY Micro Area | 46920 | 45834
36820 | Oskaloosa, IA Micro Area | 22381 | 21722
36860 | Ottawa-Streator, IL Micro Area | 154908 | 151500
36900 | Ottumwa, IA Micro Area | 35625 | 34758
36940 | Owatonna, MN Micro Area | 36576 | 35982

Get the urban/rural status group of variables (`P2`) by metropolitan/micropolitan statistical areas in 2010.

    # Show variable metadata for the P2 group
    group_p2 <- listCensusMetadata(name = "dec/sf1",
        vintage = 2010,
        type = "variables",
        group = "P2")

    # Get the P2 variable group (URBAN AND RURAL)
    data2010 <- getCensus(name = "dec/sf1",
        vintage = 2010,
        vars = "group(P2)",
        region = "metropolitan statistical area/micropolitan statistical area:*")
    head(data2010)

metropolitan_statistical_area_micropolitan_statistical_area | GEO_ID | P002001 | P002002 | P002003 | P002004 | P002005 | P002006 | NAME | P002001ERR
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
31540 | 310M100US31540 | 568593 | 455002 | 401661 | 53341 | 113591 | 0 | Madison, WI Metro Area | NA
31580 | 310M100US31580 | 46920 | 24809 | 0 | 24809 | 22111 | 0 | Madisonville, KY Micro Area | NA
36820 | 310M100US36820 | 22381 | 12545 | 0 | 12545 | 9836 | 0 | Oskaloosa, IA Micro Area | NA
36860 | 310M100US36860 | 154908 | 94406 | 0 | 94406 | 60502 | 0 | Ottawa-Streator, IL Micro Area | NA
36900 | 310M100US36900 | 35625 | 24771 | 0 | 24771 | 10854 | 0 | Ottumwa, IA Micro Area | NA
36940 | 310M100US36940 | 36576 | 25394 | 0 | 25394 | 11182 | 0 | Owatonna, MN Micro Area | NA

Get 2010 population by block group within a specific tract.

    data2000 <- getCensus(name = "sf1",
        vintage = 2000,
        vars = "P001001",
        region = "block:*",
        regionin = "state:36+county:027+tract:010000")
    head(data2000)

state | county | tract | block | P001001
--- | --- | --- | --- | ---
36 | 027 | 010000 | 1000 | 18
36 | 027 | 010000 | 1001 | 26
36 | 027 | 010000 | 1002 | 59
36 | 027 | 010000 | 1003 | 67
36 | 027 | 010000 | 1004 | 52
36 | 027 | 010000 | 1005 | 116

### Decennial Census Surname Files

Decennial Census Surname documentation

Get counts of the top 25 most popular surnames and share of each by race.

    top_surnames <- getCensus(name = "surname",
        vintage = 2010,
        vars = c("NAME", "COUNT", "PROP100K", "PCTWHITE", "PCTBLACK", "PCTAIAN", "PCTAPI", "PCTHISPANIC", "PCT2PRACE"),
        RANK = "1:25")
    head(top_surnames)

NAME | COUNT | PROP100K | PCTWHITE | PCTBLACK | PCTAIAN | PCTAPI | PCTHISPANIC | PCT2PRACE | RANK
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
SMITH | 2442977 | 828.19 | 70.9 | 23.11 | 0.89 | 0.5 | 2.4 | 2.19 | 1
JOHNSON | 1932812 | 655.24 | 58.97 | 34.63 | 0.94 | 0.54 | 2.36 | 2.56 | 2
WILLIAMS | 1625252 | 550.97 | 45.75 | 47.68 | 0.82 | 0.46 | 2.49 | 2.81 | 3
BROWN | 1437026 | 487.16 | 57.95 | 35.6 | 0.87 | 0.51 | 2.52 | 2.55 | 4
JONES | 1425470 | 483.24 | 55.19 | 38.48 | 1 | 0.44 | 2.29 | 2.61 | 5
GARCIA | 1166120 | 395.32 | 5.38 | 0.45 | 0.47 | 1.41 | 92.03 | 0.26 | 6

## Economic Census

Economic Census documentation

    ewks_2012 <- getCensus(name = "ewks",
        vintage = 2012,
        vars = c("EMP", "OPTAX", "GEOTYPE"),
        region = "state:*",
        naics2012 = 54)
    head(ewks_2012)

state | EMP | OPTAX | GEOTYPE | NAICS2012
--- | --- | --- | --- | ---
01 | 89988 | A | 02 | 54
01 | 88566 | T | 02 | 54
01 | 1422 | Y | 02 | 54
02 | 17648 | A | 02 | 54
02 | 17328 | T | 02 | 54
02 | 320 | Y | 02 | 54

    ewks_2007 <- getCensus(name = "ewks",
        vintage = 2007,
        vars = c("EMP", "OPTAX", "GEOTYPE"),
        region = "state:*",
        naics2007 = 54)
    head(ewks_2007)

state | EMP | OPTAX | GEOTYPE | NAICS2007
--- | --- | --- | --- | ---
60 | 170 | 99 | 002 | 54
66 | 2217 | 99 | 002 | 54
69 | 404 | 99 | 002 | 54
72 | 32801 | 99 | 002 | 54
78 | 1370 | 99 | 002 | 54
01 | 94051 | A | 002 | 54

## Economic Indicators

Economic Indicators documentation

    eits <- getCensus(name = "timeseries/eits/resconst",
        vars = c("cell_value", "data_type_code", "time_slot_id", "error_data", "category_code", "seasonally_adj"),
        region = "us:*",
        time = "from 2004-05 to 2012-12")
    head(eits)

cell_value | data_type_code | time_slot_id | error_data | category_code | seasonally_adj | time | us
--- | --- | --- | --- | --- | --- | --- | ---
367 | MULTI | 653 | no | ACOMPLETIONS | yes | 2004-05 | 1
1893 | TOTAL | 653 | no | ACOMPLETIONS | yes | 2004-05 | 1
1505 | SINGLE | 653 | no | ACOMPLETIONS | yes | 2004-05 | 1
11 | E_MULTI | 653 | yes | ACOMPLETIONS | yes | 2004-05 | 1
4 | E_TOTAL | 653 | yes | ACOMPLETIONS | yes | 2004-05 | 1
4 | E_SINGLE | 653 | yes | ACOMPLETIONS | yes | 2004-05 | 1

## Health Insurance Statistics

Health Insurance Statistics documentation

Get the uninsured rate by income group in Alabama for a single year.

    sahie <- getCensus(name = "timeseries/healthins/sahie",
        vars = c("NAME", "IPRCAT", "IPR_DESC", "PCTUI_PT"),
        region = "state:01",
        time = 2017)
    head(sahie)

time | state | NAME | IPRCAT | IPR_DESC | PCTUI_PT
--- | --- | --- | --- | --- | ---
2017 | 01 | Alabama | 0 | All Incomes | 11.0
2017 | 01 | Alabama | 1 | <= 200% of Poverty | 18.3
2017 | 01 | Alabama | 2 | <= 250% of Poverty | 17.3
2017 | 01 | Alabama | 3 | <= 138% of Poverty | 19.4
2017 | 01 | Alabama | 4 | <= 400% of Poverty | 14.5
2017 | 01 | Alabama | 5 | 138% to 400% of Poverty | 11.5

Get the uninsured rate in Alabama for multiple years.

    sahie_annual <- getCensus(name = "timeseries/healthins/sahie",
        vars = c("NAME", "PCTUI_PT"),
        region = "state:01",
        time = "from 2006 to 2017")
    sahie_annual

time | state | NAME | PCTUI_PT
--- | --- | --- | ---
2006 | 01 | Alabama | 15.7
2007 | 01 | Alabama | 14.6
2008 | 01 | Alabama | 15.3
2009 | 01 | Alabama | 15.8
2010 | 01 | Alabama | 16.9
2011 | 01 | Alabama | 16.6
2012 | 01 | Alabama | 15.8
2013 | 01 | Alabama | 15.9
2014 | 01 | Alabama | 14.2
2015 | 01 | Alabama | 11.9
2016 | 01 | Alabama | 10.8
2017 | 01 | Alabama | 11.0

Get the uninsured rate for non-elderly adults with incomes of 138 to 400% of the poverty line, by race and state.

    sahie_nonelderly <- getCensus(name = "timeseries/healthins/sahie",
        vars = c("NAME", "IPR_DESC", "PCTUI_PT", "AGE_DESC", "RACECAT", "RACE_DESC"),
        region = "state:*",
        time = 2017,
        IPRCAT = 5,
        AGECAT = 1)
    head(sahie_nonelderly)

time | state | NAME | IPR_DESC | PCTUI_PT | AGE_DESC | RACECAT | RACE_DESC | IPRCAT | AGECAT
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
2017 | 01 | Alabama | 138% to 400% of Poverty | 14.6 | 18 to 64 years | 0 | All Races | 5 | 1
2017 | 02 | Alaska | 138% to 400% of Poverty | 24.3 | 18 to 64 years | 0 | All Races | 5 | 1
2017 | 04 | Arizona | 138% to 400% of Poverty | 16.6 | 18 to 64 years | 0 | All Races | 5 | 1
2017 | 05 | Arkansas | 138% to 400% of Poverty | 12.4 | 18 to 64 years | 0 | All Races | 5 | 1
2017 | 06 | California | 138% to 400% of Poverty | 13.6 | 18 to 64 years | 0 | All Races | 5 | 1
2017 | 08 | Colorado | 138% to 400% of Poverty | 14.6 | 18 to 64 years | 0 | All Races | 5 | 1

## International Data Base

International Data Base documentation

Get Census Bureau projections of 2020 populations and life expectancy at birth by country.

    intl_pop <- getCensus(name = "timeseries/idb/5year",
        vars = c("NAME", "FIPS", "POP", "E0"),
        time = 2020)
    head(intl_pop)

time | NAME | FIPS | POP | E0
--- | --- | --- | --- | ---
2020 | Aruba | AA | 119428 | 77.52
2020 | Antigua and Barbuda | AC | 98179 | 77.31
2020 | United Arab Emirates | AE | 9992083 | 78.99
2020 | Afghanistan | AF | 36643815 | 52.84
2020 | Algeria | AG | 42972878 | 77.54
2020 | Azerbaijan | AJ | 10205810 | 73.58

Get predictions of population by age in 2050 for Norway for ages 10-18. https://api.census.gov/data/timeseries/idb/1year?get=AREA_KM2,NAME,AGE,POP&FIPS=NO&time=2050

    norway_pop <- getCensus(name = "timeseries/idb/1year",
        vars = c("NAME", "POP"),
        time = 2050,
        FIPS = "NO",
        AGE = "10:18")
    head(norway_pop)

time | NAME | POP | FIPS | AGE
--- | --- | --- | --- | ---
2050 | Norway | 66971 | NO | 10
2050 | Norway | 67018 | NO | 11
2050 | Norway | 67097 | NO | 12
2050 | Norway | 67199 | NO | 13
2050 | Norway | 67352 | NO | 14
2050 | Norway | 67605 | NO | 15

## International Trade

International Trade documentation

Note: The international trade datasets are buggy and frequently give the general error message of “There was an error while running your query. We’ve logged the error and we’ll correct it ASAP. Sorry for the inconvenience.” This error message comes from the U.S. Census Bureau. If you run in to repeated issues or inconsistencies, contact the Census Bureau for help or consider using a bulk data download instead.

Get the general imports value and imports for consumption value for all end-use codes and all countries for January 2018.

    imports <- getCensus(name = "timeseries/intltrade/imports/enduse",
        vars = c("CTY_CODE", "CTY_NAME", "I_ENDUSE", "I_ENDUSE_LDESC", "GEN_VAL_MO", "CON_VAL_MO"),
        time = "2018-01")
    head(imports)

time | CTY_CODE | CTY_NAME | I_ENDUSE | I_ENDUSE_LDESC | GEN_VAL_MO | CON_VAL_MO
--- | --- | --- | --- | --- | --- | ---
2018-01 | - | TOTAL FOR ALL COUNTRIES | - | TOTAL IMPORTS FOR ALL END-USE CODES | 203478379854 | 201775991054
2018-01 | 4623 | UKRAINE | - | TOTAL IMPORTS FOR ALL END-USE CODES | 94114125 | 94240024
2018-01 | 4631 | ARMENIA | - | TOTAL IMPORTS FOR ALL END-USE CODES | 8133328 | 8183048
2018-01 | 4632 | AZERBAIJAN | - | TOTAL IMPORTS FOR ALL END-USE CODES | 117941682 | 2491682
2018-01 | 4633 | GEORGIA | - | TOTAL IMPORTS FOR ALL END-USE CODES | 25082886 | 25085443
2018-01 | 4634 | KAZAKHSTAN | - | TOTAL IMPORTS FOR ALL END-USE CODES | 91374490 | 85589698

## Population Estimates and Projections

Population Estimates and Projections documentation

### Population Estimates

Population Estimates documentation

    popest <- getCensus(name = "pep/population",
        vintage = 2018,
        vars = c("GEONAME", "POP", "DATE_DESC"),
        region = "state:*")
    head(popest)

state | GEONAME | POP | DATE_DESC
--- | --- | --- | ---
01 | Alabama | 4887871 | 7/1/2018 population estimate
02 | Alaska | 737438 | 7/1/2018 population estimate
04 | Arizona | 7171646 | 7/1/2018 population estimate
05 | Arkansas | 3013825 | 7/1/2018 population estimate
06 | California | 39557045 | 7/1/2018 population estimate
08 | Colorado | 5695564 | 7/1/2018 population estimate

    popest_housing <- getCensus(name = "pep/housing",
        vintage = 2017,
        vars = c("DATE", "DATE_DESC", "GEONAME", "HUEST"),
        region = "county:195",
        regionin = "state:2")
    head(popest_housing)

state | county | DATE | DATE_DESC | GEONAME | HUEST
--- | --- | --- | --- | --- | ---
02 | 195 | 1 | 4/1/2010 Census housing unit count | Petersburg Borough, Alaska | 1994
02 | 195 | 2 | 4/1/2010 housing unit estimates base | Petersburg Borough, Alaska | 1644
02 | 195 | 3 | 7/1/2010 housing unit estimate | Petersburg Borough, Alaska | 1646
02 | 195 | 4 | 7/1/2011 housing unit estimate | Petersburg Borough, Alaska | 1647
02 | 195 | 5 | 7/1/2012 housing unit estimate | Petersburg Borough, Alaska | 1659
02 | 195 | 6 | 7/1/2013 housing unit estimate | Petersburg Borough, Alaska | 1662

### Population Projections

Population Projections documentation

    popproj <- getCensus(name = "pep/projpop",
        vintage = 2014,
        vars = c("YEAR", "POP", "AGE"),
        region = "us:1")
    head(popproj)

us | YEAR | POP | AGE
--- | --- | --- | ---
1 | 2014 | 3971847 | 0
1 | 2014 | 3957864 | 1
1 | 2014 | 3972081 | 2
1 | 2014 | 4003272 | 3
1 | 2014 | 4001929 | 4
1 | 2014 | 4002977 | 5

## Poverty Statistics

Poverty Statistics documentation

### Current Population Survey Poverty Statistics

Get national poverty rates by race for the past 50 years.

    poverty <- getCensus(name = "timeseries/poverty/histpov2",
        vars = c("RACE", "PCTPOV"),
        region = "us:*",
        time = "from 1967 to 2017")
    head(poverty)

time | us | RACE | PCTPOV
--- | --- | --- | ---
2017 | 1 | 1 | 12.3
2016 | 1 | 1 | 12.7
2015 | 1 | 1 | 13.5
2014 | 1 | 1 | 14.8
2013 | 1 | 1 | 14.8
2013 | 1 | 1 | 14.5

### Small Area Income and Poverty Estimates

Get poverty rate for children and overall for a single year.

    saipe <- getCensus(name = "timeseries/poverty/saipe",
        vars = c("NAME", "SAEPOVRT0_17_PT", "SAEPOVRTALL_PT"),
        region = "state:*",
        time = 2017)
    head(saipe)

time | state | NAME | SAEPOVRT0_17_PT | SAEPOVRTALL_PT
--- | --- | --- | --- | ---
2017 | 04 | Arizona | 21.0 | 14.9
2017 | 05 | Arkansas | 22.5 | 16.3
2017 | 01 | Alabama | 24.4 | 16.9
2017 | 02 | Alaska | 14.5 | 11
2017 | 06 | California | 18.1 | 13.3
2017 | 08 | Colorado | 12.2 | 10.3

Get the poverty rate for children and overall in a single county over time.

    saipe_years <- getCensus(name = "timeseries/poverty/saipe",
        vars = c("NAME", "SAEPOVRT0_17_PT", "SAEPOVRTALL_PT"),
        region = "county:001",
        regionin = "state:12",
        time = "from 2000 to 2017")
    head(saipe_years)

time | state | county | NAME | SAEPOVRT0_17_PT | SAEPOVRTALL_PT
--- | --- | --- | --- | --- | ---
2000 | 12 | 001 | Alachua County | 17.4 | 14.7
2001 | 12 | 001 | Alachua County | 18.3 | 15.1
2002 | 12 | 001 | Alachua County | 17.6 | 15.1
2003 | 12 | 001 | Alachua County | 19.8 | 16.2
2004 | 12 | 001 | Alachua County | 16.9 | 14.5
2005 | 12 | 001 | Alachua County | 22.8 | 21.8

### SAIPE School Districts

Get the number (`SAEPOV5_17V_PT`) and rate (`SAEPOVRAT5_17RV_PT`) of children ages 5-17 living in poverty for unified school districts in Massachusetts.

    saipe_schools <- getCensus(name = "timeseries/poverty/saipe/schdist",
        vars = c("SD_NAME", "SAEPOV5_17V_PT", "SAEPOVRAT5_17RV_PT"),
        region = "school district (unified):*",
        regionin = "state:25",
        time = 2017)
    head(saipe_schools)

time | state | school_district_unified | SD_NAME | SAEPOV5_17V_PT | SAEPOVRAT5_17RV_PT
--- | --- | --- | --- | --- | ---
2017 | 25 | 00001 | Quabbin School District | 2891 | 4.5
2017 | 25 | 00002 | Spencer-East Brookfield School District | 2100 | 9.3
2017 | 25 | 00013 | Southwick-Tolland-Granville Regional School District | 1892 | 10.4
2017 | 25 | 00067 | Manchester Essex Regional School District | 1579 | 4.6
2017 | 25 | 00542 | Ayer-Shirley School District | 2190 | 18.2
2017 | 25 | 00544 | Monomoy Regional School District | 1803 | 8.5

## Quarterly Workforce Indicators

Quarterly Workforce Indicators documentation

The allow both simple calls and very specfic ones. Make sure to read the documentation closely. Here’s a simple call that gets employment data by county.

    qwi_counties <- getCensus(name = "timeseries/qwi/sa",
        vars = c("Emp", "EarnBeg"),
        region = "county:*",
        regionin = "state:01",
        time = "2016-Q1")
    head(qwi_counties)

Emp | EarnBeg | time | state | county
--- | --- | --- | --- | ---
11366 | 2865 | 2016-Q1 | 01 | 001
64849 | 2627 | 2016-Q1 | 01 | 003
7634 | 2700 | 2016-Q1 | 01 | 005
3961 | 2821 | 2016-Q1 | 01 | 007
8002 | 2705 | 2016-Q1 | 01 | 009
2727 | 2587 | 2016-Q1 | 01 | 011

Employment data over time for a single state.

    qwi_time <- getCensus(name = "timeseries/qwi/sa",
        vars = c("Emp", "EarnBeg"),
        region = "state:01",
        time = "from 2007 to 2017")
    head(qwi_time)

Emp | EarnBeg | time | state
--- | --- | --- | ---
1873208 | 2834 | 2007-Q1 | 01
1897768 | 2786 | 2007-Q2 | 01
1889844 | 2774 | 2007-Q3 | 01
1907629 | 2978 | 2007-Q4 | 01
1878590 | 2894 | 2008-Q1 | 01
1901453 | 2881 | 2008-Q2 | 01

Here’s a much more specific call. Read the Census Bureau’s documentation closely to see all of the options allowed by the QWI APIs.

    qwi <- getCensus(name = "timeseries/qwi/sa",
        region = "state:02",
        vars = c("Emp", "sex"),
        year = 2012,
        quarter = 1,
        agegrp = "A07",
        ownercode = "A05",
        firmsize = 1,
        seasonadj = "U",
        industry = 21)
    qwi

Emp | sex | year | quarter | agegrp | ownercode | firmsize | seasonadj | industry | state
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
61 | 0 | 2012 | 1 | A07 | A05 | 1 | U | 21 | 02
55 | 1 | 2012 | 1 | A07 | A05 | 1 | U | 21 | 02
6 | 2 | 2012 | 1 | A07 | A05 | 1 | U | 21 | 02

## Survey of Business Owners

Survey of Business Owners documentation

    sbo <- getCensus(name = "sbo",
        vintage = 2012,
        vars = c("GEO_TTL", "RCPSZFI", "RCPSZFI_TTL", "FIRMPDEMP"),
        region = "state:*")
    head(sbo)

state | GEO_TTL | RCPSZFI | RCPSZFI_TTL | FIRMPDEMP
--- | --- | --- | --- | ---
01 | Alabama | 001 | All firms | 67449
01 | Alabama | 511 | Firms with sales/receipts of less than $5,000 | 356
01 | Alabama | 518 | Firms with sales/receipts of $5,000 to $9,999 | 533
01 | Alabama | 519 | Firms with sales/receipts of $10,000 to $24,999 | 1453
01 | Alabama | 521 | Firms with sales/receipts of $25,000 to $49,999 | 2843
01 | Alabama | 522 | Firms with sales/receipts of $50,000 to $99,999 | 5479

    sbo_groups <- getCensus(name = "sbo",
        vintage = 2012,
        vars = c("GEO_TTL", "RACE_GROUP", "RACE_GROUP_TTL", "FIRMPDEMP"),
        region = "county:*",
        regionin = "state:09")
    head(sbo_groups)

state | county | GEO_TTL | RACE_GROUP | RACE_GROUP_TTL | FIRMPDEMP
--- | --- | --- | --- | --- | ---
09 | 001 | Fairfield County | 00 | All firms | 21782
09 | 001 | Fairfield County | 30 | White | 17600
09 | 001 | Fairfield County | 40 | Black or African American | 176
09 | 001 | Fairfield County | 50 | American Indian and Alaska Native | 15
09 | 001 | Fairfield County | 60 | Asian | 1243
09 | 001 | Fairfield County | 61 | Asian Indian | 400

## The Planning Database

The Planning Database documentation Get population and 2010 Census mail return rates for block groups in Autauga County, AL.

    pdb <- getCensus(name = "pdb/blockgroup",
        vintage = 2018,
        vars = c("GIDBG", "County_name", "State_name", "Tot_Population_CEN_2010", "Mail_Return_Rate_CEN_2010"),
        region = "block group:*",
        regionin = "state:01+county:001")
    head(pdb)

County_name | State_name | Tot_Population_CEN_2010 | Mail_Return_Rate_CEN_2010 | state | county | tract | block_group | GIDBG
--- | --- | --- | --- | --- | --- | --- | --- | ---
Autauga County | Alabama | 698 | 81.3 | 01 | 001 | 020100 | 1 | 010010201001
Autauga County | Alabama | 1214 | 84.8 | 01 | 001 | 020100 | 2 | 010010201002
Autauga County | Alabama | 1003 | 80.2 | 01 | 001 | 020200 | 1 | 010010202001
Autauga County | Alabama | 1167 | 82.3 | 01 | 001 | 020200 | 2 | 010010202002
Autauga County | Alabama | 2549 | 80.7 | 01 | 001 | 020300 | 1 | 010010203001
Autauga County | Alabama | 824 | 76.2 | 01 | 001 | 020300 | 2 | 010010203002

## Disclaimer

This product uses the Census Bureau Data API but is not endorsed or certified by the Census Bureau.