<div dir="ltr">The benchmark at the bottom of this post shows a problem where a data.table roll="next" took nearly 150x longer than a base findInterval() solution.  (The data.table solution is easier to write though.) This suggests an area for possible speed improvement.<div>

<br><div><a href="http://stackoverflow.com/questions/21499742/fast-minimum-distance-interval-between-elements-of-2-logical-vectors-take-2/21500855#21500855">http://stackoverflow.com/questions/21499742/fast-minimum-distance-interval-between-elements-of-2-logical-vectors-take-2/21500855#21500855</a><br clear="all">

<div><br></div>-- <br>Statistics & Software Consulting<br>GKX Group, GKX Associates Inc.<br>tel: 1-877-GKX-GROUP<br>email: ggrothendieck at <a href="http://gmail.com" target="_blank">gmail.com</a><br>
</div></div></div>