Census data in R: an overview

Analyzing US Census Data in R

Kyle Walker

Instructor

Course overview

What you'll learn:

  • How to acquire US Census data with the tidycensus R package
  • How to wrangle US Census data with tidyverse tools
  • How to use the R tigris package to acquire US Census Bureau boundary data
  • How to visualize and map US Census Bureau data in R with ggplot2
Analyzing US Census Data in R

About your instructor

  • Fields: spatial demography & spatial data science
  • R developer: tidycensus, tigris, & idbr packages
Analyzing US Census Data in R

US Census Bureau Data

US Census/ACS Logo

Analyzing US Census Data in R

The US Census Bureau API

library(tidycensus)

census_api_key("YOUR KEY GOES HERE", install = TRUE)

Example key: "rw6pozt48ur2ugc8kg69x5phdrtnuhb2cb1subd6"

Analyzing US Census Data in R

Using decennial Census data with tidycensus

state_pop <- get_decennial(geography = "state", 
                           variables = "P001001")

head(state_pop)
# A tibble: 6 x 4
  GEOID NAME       variable    value
  <chr> <chr>      <chr>       <dbl>
1 01    Alabama    P001001  4779736
2 02    Alaska     P001001   710231
3 04    Arizona    P001001  6392017
4 05    Arkansas   P001001  2915918
5 06    California P001001 37253956
6 08    Colorado   P001001  5029196
Analyzing US Census Data in R

Using ACS data with tidycensus

state_income <- get_acs(geography = "state")

head(state_income)
# A tibble: 6 x 5
  GEOID NAME       variable estimate   moe
  <chr> <chr>      <chr>       <dbl> <dbl>
1 01    Alabama    hhincome    44758   314
2 02    Alaska     hhincome    74444   809
3 04    Arizona    hhincome    51340   231
4 05    Arkansas   hhincome    42336   234
5 06    California hhincome    63783   188
6 08    Colorado   hhincome    62520   287
Analyzing US Census Data in R

Let's get started!

Analyzing US Census Data in R

Preparing Video For Download...