Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

spChFIDs-methods

change feature IDs in spatial objects


Description

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.

Methods

obj = "SpatialLines", x = "character"

replace IDs in a SpatialLines object

obj = "SpatialLinesDataFrame", x = "character"

replace IDs in a SpatialLinesDataFrame object

obj = "SpatialPolygons", x = "character"

replace IDs in a SpatialPolygons object

obj = "SpatialPolygonsDataFrame", x = "character"

replace IDs in a SpatialPolygonsDataFrame object

Note

It is usually sensible to keep a copy of the original feature IDs in the object, but this should be done by the user.

Author(s)

Roger Bivand

See Also

Examples

## Not run: 
require(maptools)
xx <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], 
  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)

sp

Classes and Methods for Spatial Data

v1.4-5
GPL (>= 2)
Authors
Edzer Pebesma [aut, cre], Roger Bivand [aut], Barry Rowlingson [ctb], Virgilio Gomez-Rubio [ctb], Robert Hijmans [ctb], Michael Sumner [ctb], Don MacQueen [ctb], Jim Lemon [ctb], Finn Lindgren [ctb], Josh O'Brien [ctb], Joseph O'Rourke [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.