Skip to content

fortify problem with sp namespace #879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
seancarmody opened this issue Dec 3, 2013 · 2 comments
Closed

fortify problem with sp namespace #879

seancarmody opened this issue Dec 3, 2013 · 2 comments

Comments

@seancarmody
Copy link
Contributor

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?

@hadley
Copy link
Member

hadley commented Feb 24, 2014

This sounds like a great feature/horrible bug, but unfortunately we don't currently have the development bandwidth to support it/fix it. If you'd like to submit a pull request that implements this feature/fixes this bug, please follow the instructions in the development vignette.

@seancarmody
Copy link
Contributor Author

Pull request submitted.

hadley added a commit that referenced this issue Mar 13, 2014
Fix fortify-spatial namespace issue (#879)
@lock lock bot locked as resolved and limited conversation to collaborators Jun 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants