GEOG 4/517:  Geographic Data Analysis
Maps in R

One extremely useful feature of R for analyzing geographical data is its ability to provide maps of data in the same computing environment that the data analysis is being performed in, and moreover, to read, manipulate and analyze data with explicitly spatial coordinate information.  This facility for handling spatial data is being implemented as part of the sp package which provides an internal format for spatial data, and a number of functions for its input, output and display (together constituting a set of "classes and methods").   The main package(s) for working with spatial data include:

sp -- provides a way to read and display ESRI shapefiles (and the feature attribute data they may contain) (Edzer Pebsma and Roger Bivand)

rgdal -- provides "bindings" or a way to access the Geospatial Data Abstraction Library (GDAL) and the projection/transformation operations from the PROJ.4 library

maptools -- a set of tools for manipulating and reading geographic data, in particular ESRI shapefiles

Other mapping-related package include

maps (Original S code by Richard A. Becker and Allan R. Wilks. R version by Ray Brownrigg and enhancements by Thomas P Minka) which provides basemaps for the world, countries, and U.S. counties and allows the creation of simple choropleth and symbol-based maps;

mapdata (Original S code by Richard A. Becker and Allan R. Wilks. R version by Ray Brownrigg) which provides additional map databases for the maps package;

mapproj (Doug McIlroy. Packaged for R by Ray Brownrigg and Thomas P Minka), does map-projection calculations;

maptree (Denis White), facilitates the display of classification and regression tree analyses of spatial data;

shapefiles (Ben Stabler), reads and writes ESRI shapefiles; and

RColorBrewer (Cindy Brewer), while not a mapping package provides good color schemes for mapping and data display in general.

There is an R Spatial Projects working group and discussion list that focuses on the analysis of spatial data and mapping in general.

The main place to go to get an overview of the kinds and capabilities of the spatial packages in R is the Spatial Task Views on CRAN

maps in R examples

Readings:  Browse through the book, Bivand, R., et al. (2008) Applied Spatial Data Analysis with R.  (on reserve)