Skip to contents

Determines the location, i.e., index of the first or last TRUE value in a logical vector.

Usage

which.first(x)

which.last(x)

Arguments

x

logical, vector.

Value

integer, index of the first/last TRUE

value. integer(0) if no TRUE (everything FALSE or NA) was found.

See also

which.min()

Other helper functions for developers: between(), isPeaksMatrix(), rbindFill(), validPeaksMatrix(), vapply1c()

Author

Sebastian Gibb

Examples

l <- 2 <= 1:3
which.first(l)
#> [1] 2
which.last(l)
#> [1] 3