Basic tidycensus functionality

Analyzing US Census Data in R

Kyle Walker

Instructor

Geography in tidycensus

Analyzing US Census Data in R

Geography and variables in tidycensus

county_income <- get_acs(geography = "county", 
                         variables = "B19013_001")
county_income
# A tibble: 3,220 x 5
   GEOID NAME                     variable   estimate   moe
   <chr> <chr>                    <chr>         <dbl> <dbl>
 1 01001 Autauga County, Alabama  B19013_001    53099  2631
 2 01003 Baldwin County, Alabama  B19013_001    51365   991
 3 01005 Barbour County, Alabama  B19013_001    33956  2655
 4 01007 Bibb County, Alabama     B19013_001    39776  3306
 5 01009 Blount County, Alabama   B19013_001    46212  2443
 6 01011 Bullock County, Alabama  B19013_001    29335  5435
 7 01013 Butler County, Alabama   B19013_001    34315  2904
# ... with 3,213 more rows
Analyzing US Census Data in R

Geographic subsets in tidycensus

texas_income <- get_acs(geography = "county", 
                        variables = c(hhincome = "B19013_001"), 
                        state = "TX")
texas_income
# A tibble: 254 x 5
   GEOID NAME                    variable estimate   moe
   <chr> <chr>                   <chr>       <dbl> <dbl>
 1 48001 Anderson County, Texas  hhincome    42146  2539
 2 48003 Andrews County, Texas   hhincome    70121  7053
 3 48005 Angelina County, Texas  hhincome    44185  2107
 4 48007 Aransas County, Texas   hhincome    44851  4261
 5 48009 Archer County, Texas    hhincome    62407  5368
 6 48011 Armstrong County, Texas hhincome    65000  9415
# ... with 248 more rows
Analyzing US Census Data in R

Wide data with tidycensus

get_acs(geography = "county", 
        variables = c(hhincome = "B19013_001", 
                      medage = "B01002_001"), 
        state = "TX", 
        output = "wide")
# A tibble: 254 x 6
   GEOID NAME                    hhincomeE hhincomeM medageE medageM
   <chr> <chr>                       <dbl>     <dbl>   <dbl>   <dbl>
 1 48001 Anderson County, Texas      42146      2539    38.9     0.5
 2 48003 Andrews County, Texas       70121      7053    31.2     0.8
 3 48005 Angelina County, Texas      44185      2107    36.7     0.3
 4 48007 Aransas County, Texas       44851      4261    50.7     1.1
 5 48009 Archer County, Texas        62407      5368    44.1     0.7
 6 48011 Armstrong County, Texas     65000      9415    45.9     2.8
# ... with 248 more rows
Analyzing US Census Data in R

Let's practice!

Analyzing US Census Data in R

Preparing Video For Download...