[R-sig-Geo] Plotting shapefiles in R

Tom Philippi tephilippi at gmail.com
Wed Jan 11 21:36:14 CET 2012


Roger didn't say it (but he wrote the book on it), but an alternative
would be something like:
library(sp)
library(rgdall)
poli<-readOGR("directory","shapefilename without .shp")
class(poli) # SpatialPolygonsDataFrame
proj4string(poli) # projection information
spplot(poli)

One advantage is that by using sp classes, this approach allows you to
reproject via spTransform(), colorize polygons by values of an
attribute in the dataframe in spplot(), and actually do more things
with the spatial data.

Tom 2



More information about the R-sig-Geo mailing list