Skip to contents

Emulates behavior of find

Usage

find(x, sort = TRUE)

Arguments

x

object or logic operation on an object

sort

sort output?

Value

A vector of indices of x that satisfy the logical test (nonzero, by default).

Examples

X <- matrix(c(1, 0, 2, 0, 1, 1, 0, 0, 4), 3, byrow = TRUE)
Y <- seq(1, 19, 2)
find(X)
#> [1] 1 5 7 8 9
find(Y == 13)
#> [1] 7