wf {checkmate} | R Documentation |
Get the index of the first/last TRUE
Description
A quick C implementation for “which.first” (head(which(x), 1)
) and
“which.last” (tail(which(x), 1)
).
Usage
wf(x, use.names = TRUE)
wl(x, use.names = TRUE)
Arguments
x |
[ |
use.names |
[ |
Value
[integer(1)
| integer(0)
].
Returns the index of the first/last TRUE
value in x
or
an empty integer vector if none is found. NAs are ignored.
Examples
wf(c(FALSE, TRUE))
wl(c(FALSE, FALSE))
wf(NA)
[Package checkmate version 2.3.2 Index]