Hi,

Thanks Michael, but i think this is even slower.

 x <-sample(20000000)
 which(x < 5)[1]
 which.max(x < 5)
 system.time(for(i in 1:100) which.max(x < 5))
       User      System verstrichen
      60.84       13.70       86.33
 system.time(for(i in 1:100) which(x < 5)[1])
       User      System verstrichen
      40.45        8.25       48.95



Thanks,
Nico

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to