ABSTRACT

R may never replace full-featured mapping software like Esri’s ArcGIS or open-source QGIS, which were specifically designed for sophisticated geospatial analysis. However, R does have some pretty robust capabilities for working with spatial data. R is preferable when the need is a single, reproducible workflow; or when a user is looking for more customization than Fusion Tables or Google Maps offers out of the box. This chapter deals with importing geographic shapefiles into R, finding ready-to-use US Census shapefiles that include data, generating static and interactive choropleth maps, joining geospatial files with other data, and geocoding addresses with ggmap. It also covers learning R’s paste() and paste0() functions; glue, a paste0 alternative; creating an interactive map of geocoded locations; combining points and polygons on a map; and adding address search to a map.