 <p>As the <code>rle</code> is a <code>list</code> object with <code>lengths</code> and <code>values</code> as elements of the <code>list</code>, we can extract the <code>lengths</code> and <code>sum</code></p> <pre><code>sum(b$lengths) #[1] 10 </code></pre>