unique | R Documentation |
This method returns the unique values in a SpatRaster, or removes duplicates records (geometry and attributes) in a SpatVector.
## S4 method for signature 'SpatRaster' unique(x, incomparables=FALSE, na.rm=TRUE, as.raster=FALSE) ## S4 method for signature 'SpatVector' unique(x, incomparables=FALSE, ...)
x |
SpatRaster or SpatVector |
incomparables |
logical. If |
na.rm |
logical. If |
as.raster |
logical. If |
... |
additional arguments passed on to |
If x
is a SpatRaster: data.frame or list (if incomparables=FALSE
)
If x
is a SpatVector: SpatVector
r <- rast(ncols=5, nrows=5) values(r) <- rep(1:5, each=5) unique(r) s <- c(r, round(r/3)) unique(s) unique(s,TRUE) unique(s, as.raster=TRUE) v <- vect(cbind(x=c(1:5,1:5), y=c(5:1,5:1)), crs="+proj=utm +zone=1 +datum=WGS84") nrow(v) u <- unique(v) nrow(u) values(v) <- c(1:5, 1:3, 5:4) unique(v)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.