I loaded a shapefile in R using readOGR
and I named as data.map
I can see the shape pretty well by using
plot(data.map)
The issue is that polygons' ID (the ID of the plot) is not the same with the @data
ID. What I mean is that, when I run:
plot(data.map[2, ])
and then run
data.map@data[2, ]
the polygon that is drawn in the plot is not the one that the data row refers to.
I do not know if i can delete the question. I found the solution. the problem was that after a merge procedure many of the @data rows were deleted and that resulted to have the ids messed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.