title: merge data vector to shapefile data slot
body: <p>i try do add economic data to a shapefile using <code>merge</code> and the 2 digit ISO code as ID. The code looks somewhat like this:</p>
  
  <pre><code>library(maptools)
  library(foreign)
  library(sp)
  library(lattice)
  library(shapefiles)
  
  world.shp&lt;-readShapePoly("world_shapefile.shp")
  
  world.shp@data&lt;-merge(world.shp@data, data.frame(country=iso.code.vector, net=country.data.vector), by.x="ISO2", by.y="country", all.x=TRUE, sort=FALSE)
  </code></pre>
  
  <p>Unfortunately this ruins the order of the .shp file even though i put the <code>sort</code> argument. A plot afterwards shows me that the data does not match the polygons like it should. What am i doing wrong?</p>
  
  <p>i got the world map data from <a href="http://thematicmapping.org/downloads/world_borders.php" rel="nofollow">thematicmapping.org</a></p>
  
  <p>Thanks for your help</p>