firstNA {bit} | R Documentation |
Position of first NA
Description
This is substantially faster than which.max(is.na(x))
Usage
firstNA(x)
Arguments
x |
an R vector |
Value
a reversed vector
See Also
which.max()
, is.na()
, anyNA()
, anyDuplicated()
, bit_anyDuplicated()
Examples
x <- c(FALSE, NA, TRUE)
firstNA(x)
reverse_vector(x)
## Not run:
x <- 1:1e7
system.time(rev(x))
system.time(reverse_vector(x))
## End(Not run)
[Package bit version 4.6.0 Index]