The question posed in here , has been solved but somehow it is not working for a different shp file. Any idea why? I have been trying with the shp file from Coloring the states
Your merge is matching each row more than once, creating duplicate rows in the data. Additionally there is an ordering problem, and you lose polygons when there isn't a matching row.
Replace
f_india <- merge(x=f_india, y=india@data, by.x="id", by.y="ID")
with
f_india <- merge(x=f_india, y=unique(india@data), by.x="id", by.y="ID",all.x=T)
f_india <- f_india[with(f_india, order(id, order)), ]
EDIT:
Here's the output I get. The grey polygons are caused by mismatched names, but this is the only issue I can see.
