| 1 |
\name{spChFIDs-methods} |
| 2 |
\docType{methods} |
| 3 |
\alias{spChFIDs-methods} |
| 4 |
\alias{spChFIDs<-} |
| 5 |
\alias{spChFIDs<-,Spatial-method} |
| 6 |
\alias{spChFIDs,SpatialLines,character-method} |
| 7 |
\alias{spChFIDs,SpatialLinesDataFrame,character-method} |
| 8 |
\alias{spChFIDs,SpatialPolygons,character-method} |
| 9 |
\alias{spChFIDs,SpatialPolygonsDataFrame,character-method} |
| 10 |
\title{change feature IDs in spatial objects} |
| 11 |
\alias{spChFIDs} |
| 12 |
\description{ |
| 13 |
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. |
| 14 |
} |
| 15 |
\section{Methods}{ |
| 16 |
\describe{ |
| 17 |
|
| 18 |
\item{obj = "SpatialLines", x = "character"}{replace IDs in a SpatialLines object} |
| 19 |
|
| 20 |
\item{obj = "SpatialLinesDataFrame", x = "character"}{replace IDs in a SpatialLinesDataFrame object} |
| 21 |
|
| 22 |
\item{obj = "SpatialPolygons", x = "character"}{replace IDs in a SpatialPolygons object} |
| 23 |
|
| 24 |
\item{obj = "SpatialPolygonsDataFrame", x = "character"}{replace IDs in a SpatialPolygonsDataFrame object} |
| 25 |
}} |
| 26 |
|
| 27 |
\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.} |
| 28 |
|
| 29 |
\author{Roger Bivand} |
| 30 |
|
| 31 |
|
| 32 |
\examples{ |
| 33 |
\dontrun{ |
| 34 |
if(require(sf)) { |
| 35 |
xx <- as(st_read(system.file("shape/nc.shp", package="sf")[1]), "Spatial") |
| 36 |
row.names(xx) <- as.character(xx$"FIPSNO") |
| 37 |
row.names(as(xx, "data.frame")) |
| 38 |
xx1 <- spChFIDs(xx, as.character(xx$CNTY_ID)) |
| 39 |
row.names(as(xx1, "data.frame")) |
| 40 |
}} |
| 41 |
} |
| 42 |
\keyword{methods} |
| 43 |
\keyword{spatial} |