broom (version 0.4.1)

sp_tidiers: tidying methods for classes from the sp package.

Description

Tidy classes from the sp package to allow them to be plotted using ggplot2. To figure out the correct variable name for region, inspect as.data.frame(x).

Usage

"tidy"(x, region = NULL, ...)
"tidy"(x, ...)
"tidy"(x, ...)
"tidy"(x, ...)
"tidy"(x, ...)
"tidy"(x, ...)
"tidy"(x, ...)

Arguments

x
SpatialPolygonsDataFrame to convert into a dataframe.
region
name of variable used to split up regions
...
not used by this method

Details

These functions originated in the ggplot2 package as "fortify" functions.

Examples

Run this code
if (require("maptools")) {
    sids <- system.file("shapes/sids.shp", package="maptools")
    nc1 <- readShapePoly(sids,
    proj4string = CRS("+proj=longlat +datum=NAD27"))
    nc1_df <- tidy(nc1)
}

Run the code above in your browser using DataLab