TopologyException error during fortify SpatialPolygonsDataFrame
I tried to reproduce a recent question on spatial data visualization using ggplot2 and received the following error message during
fortify(world, region = "ISO3"):
Error: TopologyException: Input geom 0 is invalid: Self-intersection at or near point 3980740.7660219339 4277735.2740812832 at 3980740.7660219339 4277735.2740812832
Any ideas on that?
As per my comment in that question, it's to do with the
spTransform. Simply remove the offending line:
world <- spTransform(world, CRS("+proj=robin"))