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.