diff --git a/NEWS b/NEWS index 3b8aff10c9..d6fa2242a6 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ ggplot2 0.9.3.1.99 * `ggpcp()`, `ggfluctuation()`, `ggmissing()`, `ggstructure()`, and `ggorder()` are now defunct and have been removed. + +* `fortify.SpatialPolygonsDataFrame()` now calls `polygons` without requiring the `sp` to be loaded first. Addresses issue #879 https://github.com/hadley/ggplot2/issues/879 ggplot2 0.9.3.1 diff --git a/R/fortify-spatial.r b/R/fortify-spatial.r index a94d30ccd3..9aaed2d506 100644 --- a/R/fortify-spatial.r +++ b/R/fortify-spatial.r @@ -27,7 +27,7 @@ fortify.SpatialPolygonsDataFrame <- function(model, data, region = NULL, ...) { coords <- ldply(model@polygons,fortify) message("Regions defined for each Polygons") } else { - cp <- polygons(model) + cp <- sp::polygons(model) try_require("maptools") # Union together all polygons that make up a region