sp_tidiers {broom} | R Documentation |
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)
.
## S3 method for class 'SpatialPolygonsDataFrame' tidy(x, region = NULL, ...) ## S3 method for class 'SpatialPolygons' tidy(x, ...) ## S3 method for class 'Polygons' tidy(x, ...) ## S3 method for class 'Polygon' tidy(x, ...) ## S3 method for class 'SpatialLinesDataFrame' tidy(x, ...) ## S3 method for class 'Lines' tidy(x, ...) ## S3 method for class 'Line' tidy(x, ...)
x |
|
region |
name of variable used to split up regions |
... |
not used by this method |
These functions originated in the ggplot2 package as "fortify" functions.
if (require("maptools")) { sids <- system.file("shapes/sids.shp", package="maptools") nc1 <- readShapePoly(sids, proj4string = CRS("+proj=longlat +datum=NAD27")) nc1_df <- tidy(nc1) }