Skip to content
Prev 322530 / 398502 Next

speed of a vector operation question

A very similar question was asked on StackOverflow (by Mikhail? and then I guess 
the answers there were somehow not satisfactory...)

 
http://stackoverflow.com/questions/16213029/more-efficient-strategy-for-which-or-match

where it turns out that a binary search (implemented in R) on the sorted vector 
is much faster than sum, etc. I guess because it's log N without copying. The 
more complicated condition x > .3 & x < .5 could be satisfied with multiple 
calls to the search.

Martin
On 04/26/2013 01:20 PM, William Dunlap wrote: