Which
returns a RasterLayer with TRUE
or FALSE
. Cells with 1 are set to TRUE
, all other cells, including NA
are set to FALSE
Which(x, ...)
cells
. If cells=FALSE
(the default), a (logical) RasterLayer is returned, if cells=TRUE
, the cell numbers are returned for which the condition is TRUE
which
r <- raster(ncol=10, nrow=10)
r[] <- runif(ncell(r))
r[r< 0.2] <- NA
s <- Which(r > 0.5, cells=TRUE)
s[1:5]
s <- Which(r > 0.5)
Run the code above in your browser using DataLab