 <p>Joshua and Aaron were spot on. However, their code can still be made more than twice as fast by careful use of the correct types, integers and logicals:</p> <p>split(v, cumsum(c(TRUE, diff(v)!=1L)))</p> <pre><code>&gt; v=rep(c(1:5,19), len=1e6) # Huge vector... &gt; system.time( split(v,cumsum(c(1,diff(v)!=1))) ) # Joshua's code user system elapsed 2.64 0.00 2.64 &gt; system.time( split(v, cumsum(c(TRUE, diff(v)!=1L))) ) # Modified code user system elapsed 1.09 0.00 1.12 </code></pre>