When the feature IDs need to be changed in SpatialLines* or SpatialPolygons* objects, these methods may be used. The new IDs should be a character vector of unique IDs of the correct length.
replace IDs in a SpatialLines object
replace IDs in a SpatialLinesDataFrame object
replace IDs in a SpatialPolygons object
replace IDs in a SpatialPolygonsDataFrame object
It is usually sensible to keep a copy of the original feature IDs in the object, but this should be done by the user.
## Not run: require(maptools) xx <- readShapePoly(system.file("shapes/sids.shp", package="maptools"), IDvar="FIPSNO", proj4string=CRS("+proj=longlat +ellps=clrk66")) row.names(as(xx, "data.frame")) xx1 <- spChFIDs(xx, as.character(xx$CNTY_ID)) row.names(as(xx1, "data.frame")) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.