Learn R Programming

terra (version 1.7-55)

which.lyr: Which cells are TRUE?

Description

This method returns a single layer SpatRaster with cell values indicating the first layer in the input that is TRUE. All numbers that are not zero (or FALSE), are considered to be TRUE.

Usage

# S4 method for SpatRaster
which.lyr(x)

Value

SpatRaster

Arguments

x

SpatRaster

See Also

isTRUE, which, See Summary-methods for which.min and which.max

Examples

Run this code
s <- rast(system.file("ex/logo.tif", package="terra"))   
x <- which.lyr(s > 100)

Run the code above in your browser using DataLab