This function returns the unique values in a RasterLayer object or the unique combinations of the layers in a multilayer object.

# S4 method for RasterLayer,missing
unique(x, incomparables=FALSE, na.last=NA, progress="", ...) 

# S4 method for RasterStackBrick,missing
unique(x, incomparables=FALSE, na.last=NA, progress="", ...)

Arguments

x

Raster object

incomparables

must be missing. The default value FALSE is used. See unique

na.last

logical. for controlling the treatment of NAs. If TRUE, missing values in the data are put last; if FALSE, they are put first; if NA, they are removed.

progress

character. Use "text" or "window" for a progress indicator

...

additional arguments. as in unique

See also

Value

vector or matrix

Examples

r <- raster(ncol=10, nrow=10)
values(r) <- round(runif(ncell(r))*10)
unique(r)
#>  [1]  0  1  2  3  4  5  6  7  8  9 10
unique(stack(r, round(r/2)))
#>       layer.1 layer.2
#>  [1,]      10       5
#>  [2,]       8       4
#>  [3,]       3       2
#>  [4,]       9       4
#>  [5,]       7       4
#>  [6,]       5       2
#>  [7,]       4       2
#>  [8,]       6       3
#>  [9,]       2       1
#> [10,]       0       0
#> [11,]       1       0