Customizing tigris options

Analyzing US Census Data in R

Kyle Walker

Instructor

Cartographic boundary shapefiles

  • TIGER/Line shapefiles include water area of entities
    • Can be unsuitable for thematic mapping
  • Alternative: cartographic boundary shapefiles
    • Available in tigris with argument cb = TRUE
Analyzing US Census Data in R

TIGER/Line vs. cartographic boundary files

ri_tiger <- counties("RI")
ri_cb <- counties("RI", cb = TRUE)

par(mfrow = c(1, 2)) plot(ri_tiger, main = "TIGER/Line") plot(ri_cb, main = "Cartographic boundary")

Rhode Island compared

Analyzing US Census Data in R

tigris and simple features

options(tigris_class = "sf")
az_sf <- counties("AZ", cb = TRUE)
class(az_sf)
"sf"         "data.frame"
st_geometry(az_sf)
Geometry set for 15 features 
geometry type:  MULTIPOLYGON
dimension:      XY
bbox:           xmin: -114.8165 ymin: 31.33218 xmax: -109.0452 ymax: 37.00426
epsg (SRID):    4269
proj4string:    +proj=longlat +datum=NAD83 +no_defs
Analyzing US Census Data in R

Caching tigris data

  • Waiting for large Census shapefiles to download can be tedious!
  • Alternative: options(tigris_use_cache = TRUE)
  • To set the cache directory: tigris_cache_dir() function
Analyzing US Census Data in R

Historical data and tigris

  • Historical data can be obtained in tigris by using the year parameter
  • Data available for 1990, 2000, 2010, and 2011-2017
williamson90 <- tracts(state = "TX", county = "Williamson", 
                       cb = TRUE, year = 1990)

williamson16 <- tracts(state = "TX", county = "Williamson", 
                       cb = TRUE, year = 2016)

par(mfrow = c(1, 2))
plot(williamson90$geometry)
plot(williamson16$geometry)
Analyzing US Census Data in R

Williamson County compared

Analyzing US Census Data in R

Let's practice!

Analyzing US Census Data in R

Preparing Video For Download...