Skip to content
Prev 8293 / 29559 Next

rbind of SpPolDFs

Hi!

I have a set of shapefiles, each one with one single polygon, and I
want to end up with one single SpPolDF including all polygons.
I read the set of shapefiles with readOGR() and thus get one SpPolDF
for each polygon.
I (unsuccessfully)  try:
Error in validObject(.Object) :
  invalid class "SpatialPolygons" object: non-unique Polygons ID slot values
Calls: rbind.SpatialPolygons ... SpatialPolygons -> new -> initialize
-> initialize -> validObject
Error in validObject(.Object) :
  invalid class "SpatialPolygons" object: non-unique Polygons ID slot values
Calls: rbind.SpatialPolygonsDataFrame ... SpatialPolygons -> new ->
initialize -> initialize -> validObject
Error in as(x, "SpatialPolygons") :
  no method or default for coercing "list" to "SpatialPolygons"
Calls: rbind.SpatialPolygonsDataFrame -> do.call -> lapply -> FUN -> as

and some other variants.

Any help on how to do this? A solution would be using joinPolys from
maptools (the polygons do not overlap), but think that
rbind.SpatialPolygonsDataFrame() is better suited for this operation.

Agus