powered by
This is substantially faster than which.max(is.na(x))
which.max(is.na(x))
firstNA(x)
a reversed vector
an R vector
which.max, is.na, anyNA, anyDuplicated, bit_anyDuplicated
which.max
is.na
anyNA
anyDuplicated
bit_anyDuplicated
x <- c(FALSE,NA,TRUE) firstNA(x) reverse_vector(x) if (FALSE) { x <- 1:1e7 system.time(rev(x)) system.time(reverse_vector(x)) }
Run the code above in your browser using DataLab