Find distribution of consecutive zeros : <p>I have a vector, say <code>x</code> which contains only the integer numbers <code>0</code>,<code>1</code> and <code>2</code>. For example;</p>

<pre><code>x &lt;- c(0,1,0,2,0,0,1,0,0,1,0,0,0,1,0)
</code></pre>

<p>From this I would like to extract how many times zero occurs in each "pattern". In this simple example it occurs three times on it own, twice as <code>00</code> and exactly once as <code>000</code>, so I would like to output something like:</p>

<pre><code>0      3
00     2
000    1
</code></pre>

<p>My actual dataset is quite large (1000-2000 elements in the vector) and at least in theory the maximum number of consecutive zeros is <code>length(x)</code></p>
