raster (version 1.0.4)

which: Which cells are TRUE?

Description

which returns a RasterLayer with TRUE or FALSE. Cells with 1 are set to TRUE, all other cells, including NA are set to FALSE

Usage

which(x, arr.ind=FALSE)

Arguments

x
A RasterLayer object or a logical expression resulting in a RasterLayer object
arr.ind
Logical. If FALSE, a (logical) RasterLayer is returned, if TRUE, the cellnumbers are returned for which the condition is TRUE. Note that this behavior is somewhat different from the generic 'which' in the base packag

Value

  • a RasterLayer object

See Also

which

Examples

Run this code
r <- raster(ncol=10, nrow=10)
r[] <- runif(ncell(r))
r[r< 0.2] <- NA
s <- which(r > 0.5)

Run the code above in your browser using DataLab