Unique values
This function returns the unique values in a SpatRaster or removes duplicates in a SpatVector.
## S4 method for signature 'SpatRaster' unique(x, incomparables=FALSE) ## S4 method for signature 'SpatVector' unique(x, incomparables=FALSE, ...)
x |
SpatRaster or SpatVector |
incomparables |
logical. If |
... |
additional arguments passed on to base::unique |
If x
is a SpatRaster: vector or matrix
If x
is a SpatVector: SpatVector
r <- rast(ncol=5, nrow=5) values(r) <- rep(1:5, each=5) unique(r) s <- c(r, round(r/3)) unique(s) unique(s,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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.