Skip to content
Prev 6701 / 29559 Next

subset SpatialPolygonsDataFrame using negative index?

On Wed, 21 Oct 2009, stubben wrote:

            
No, the negative index doesn't work, I'll try to commit a fix to sp. In 
fact, I'd rather do:

nm <- readShapePoly("co35_d00.shp", proj4string=CRS("+proj=longlat"))
nm1 <- unionSpatialPolygons(nm, nm$COUNTY)
df <- as(nm, "data.frame")[-13,]
row.names(df) <- df$COUNTY
nm2 <- SpatialPolygonsDataFrame(nm1, df)

which makes a multipolygon for Sandoval and drops the attributes for the 
second member polygon.

Hope this helps,

Roger