class: center, middle, inverse, title-slide # Using Mapbox for Spatial Data Science in R ## Penn MUSA Masterclass 2020 ### Kyle Walker ### October 9, 2020 --- class: middle, center, inverse ## Introduction: research & open source software --- ## My academic research before R <img src="img/urban_map.png" style="width: 450px"><img src="img/boomer_map.png" style="width: 300px"> --- ## Spatial R and the tidyverse <img src="https://tidyverse.tidyverse.org/logo.png" style="width: 300px"><img src="https://user-images.githubusercontent.com/520851/34887433-ce1d130e-f7c6-11e7-83fc-d60ad4fae6bd.gif" style="width: 350px"> --- ## tigris * My first R package; first released in 2015 * Automates acquisition and loading of US Census Bureau TIGER/Line shapefiles in R ```r library(tigris) options(tigris_use_cache = TRUE) dallas_tracts <- tracts("TX", "Dallas", cb = TRUE) ``` --- ```r plot(dallas_tracts$geometry) ``` <!-- --> --- ## tidycensus * First released in 2017; loads data from the decennial Census or American Community survey APIs optionally pre-joined with Census shapefiles ```r library(tidycensus) broadband <- get_acs( geography = "tract", variables = "DP02_0152P", state = "TX", county = "Dallas", geometry = TRUE ) ``` ``` ## Getting data from the 2014-2018 5-year ACS ``` ``` ## Using the ACS Data Profile ``` --- ```r library(mapview) mapview(broadband, zcol = "estimate") ```
--- ## Mapbox and my research [_Mapping Immigrant America_ (2015, 2020)](http://personal.tcu.edu/kylewalker/immigrant-america/#8.95/33.9529/-118.1402)  --- ## The Mapbox platform As I discovered, there is quite a bit more to Mapbox than just Studio/GL JS...  --- ## {mapboxapi} The {mapboxapi} R package is an effort to: * Help R users incorporate Mapbox web services into their maps / sf-based analysis projects * Combine Mapbox services when appropriate for common use cases * Use R as a bridge between analysts' data pipelines & visualization projects (with Leaflet, tippecanoe, Mapbox Studio, etc.) --- class: middle, center, inverse ## Tutorial: using Mapbox APIs in R