Closed
Description
This may be a bit obscure, but I have found a problem using fortify
for a SpatialPolygonsDataFrame
when sp
has not been loaded. While that may seem an unlikely scenario, it came up for me when trying to plot map data which loaded from files created using save
. Here is an artificial reproducible example of the error
bx <- rgeos::readWKT("POLYGON ((112.5 -44, 112.5 -9, 154 -9, 154 -44, + 112.5 -44))")
bx <- as(bx, "SpatialPolygonsDataFrame")
fortify(bx, region="dummy")
# Error in fortify.SpatialPolygonsDataFrame(bx, region = "dummy") :
# could not find function "polygons"
If I run library(sp)
first the error goes away, but should fortify
use sp::polygons
rather than polygons
to avoid the error altogether?
Metadata
Metadata
Assignees
Labels
No labels