This method returns the unique values in a SpatRaster, or removes duplicates records (geometry and attributes) in a SpatVector.
methods
## S4 method for signature 'SpatRaster'unique(x, incomparables=FALSE, digits=NA, na.rm=TRUE, as.raster=FALSE)## S4 method for signature 'SpatVector'unique(x, incomparables=FALSE,...)
Arguments
x: SpatRaster or SpatVector
incomparables: logical. If FALSE and x is a SpatRaster: the unique values are determined for all layers together, and the result is a matrix. If TRUE, each layer is evaluated separately, and a list is returned. If x is a SpatVector this argument is as for a data.frame
digits: integer. The number of digits for rounding the values before finding the unique values. Use NA means to not do any rounding
na.rm: logical. If TRUE, NaN is included if there are any missing values
as.raster: logical. If TRUE, a single-layer categorical SpatRaster with the unique values is returned
...: additional arguments passed on to unique
Returns
If x is a SpatRaster: data.frame or list (if incomparables=FALSE)