title: How to count the number of changes in column (R)
body: <pre><code>df &lt;- data.frame(Name=c('black','white','green','red','brown', 'blue'),
                   Num=c(1,1,1,0,1,0))
  </code></pre>
  
  <p>How many times 1 changed to 0 in the column Num? How I can count it by R?</p>