unique: Unique values

Description Usage Arguments Value See Also Examples

Description

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

Usage

1
2
3
4
5
## S4 method for signature 'RasterLayer,missing'
unique(x, incomparables=FALSE, na.last=NA, progress="", ...) 

## S4 method for signature '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

Value

vector or matrix

See Also

unique

Examples

1
2
3
4
5
6
r <- raster(ncol=10, nrow=10)
values(r) <- round(runif(ncell(r))*10)
unique(r)
u <- unique(stack(r, round(r/2)))
do.call(rbind, u)
lapply(u, unique)

Example output

Loading required package: sp
 [1]  0  1  2  3  4  5  6  7  8  9 10
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
[1,]    0    1    2    3    4    5    6    7    8     9    10
[2,]    0    0    1    2    2    2    3    4    4     4     5
[[1]]
 [1]  0  1  2  3  4  5  6  7  8  9 10

[[2]]
[1] 0 1 2 3 4 5

raster documentation built on Aug. 23, 2019, 1:04 a.m.