1\name{which.lyr}
2
3\docType{methods}
4
5\alias{which.lyr}
6\alias{which.lyr,SpatRaster-method}
7
8\title{Which cells are TRUE?}
9
10\description{
11This method returns a single layer SpatRaster with cell values that are the first layer in the input that has the value is not zero (FALSE), and, hence, is \code{TRUE}.
12}
13
14
15\usage{
16\S4method{which.lyr}{SpatRaster}(x)
17}
18
19\arguments{
20  \item{x}{SpatRaster}
21}
22
23
24\value{
25SpatRaster
26}
27
28\seealso{\code{\link{isTRUE}}, \code{\link{which}}, See \code{\link{Summary-methods}} for \code{which.min} and \code{which.max}}
29
30
31\examples{
32s <- rast(system.file("ex/logo.tif", package="terra"))
33x <- which.lyr(s > 100)
34}
35
36\keyword{spatial}
37