Position of first NA
This is substantially faster than which.max(is.na(x))
firstNA(x)
x |
an R vector |
a reversed vector
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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.