Learn R Programming

eeptools (version 0.3.1)

ggmapmerge: Fortify a SpatialPolygonsDataFrame

Description

Convenience function for fortifying SpatialPolygonsDataFrames for ggplot2 plotting.

Usage

ggmapmerge(mapobj, xid)

Arguments

mapobj
Name of an S4 SpatialPolygonsDataFrame
xid
Name of ID variable in the SpatialPolygonsDataFrame

Value

  • An S3 dataframe suitable for using in a gggplot2 map

Details

This function requires maptools to be loaded and gpclibPermit to be TRUE. This is because it depends on the fortify method in ggplot2.

Examples

Run this code
xx <- maptools::readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], IDvar="FIPSNO")
plotobj<-ggmapmerge(xx,"FIPS")

Run the code above in your browser using DataLab