Skip to content
Prev 12780 / 29559 Next

rbind problems with SpatialPolygonsDataFrame

R-sig-geo'ers:

I apologize that I can't provide the input data, but maybe the info
below can illuminate the problem.  Basically, I'm trying to rbind two
SpatialPolygonDataFrames together, but I'm getting a strange error:

'no method or default for coercing "logical" to "SpatialPolygons"'

Does rbind only work on SpatialPolygons (e.g. should I rbind the
SpatialPolygons and the data.frame separately, then piece them back
together afterwards?)

Note the "replacement" call was because I couldn't figure out how to
do.call(rbind) and pass along the "makeUniqueIDs=TRUE"
Error in as(x, "SpatialPolygons") :
  no method or default for coercing "logical" to "SpatialPolygons"
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"

This was a single step from a larger looping I used in lieu of do.call:
for(i in (1:length(boundary_vectors_unmerged)))
	{
		print(i)
		if(i==1)
		{
			boundary_vectors=boundary_vectors_unmerged[[i]]
		} else
		{
			boundary_vectors=rbind(boundary_vectors,boundary_vectors_unmerged[[i]],makeUniqueIDs=TRUE)
		}
	}


--j