title: Increasingly count the number of times that a certain condition is met (R)
body: <p>I would like to know how to increasingly count the number of times that a column in my data.frame satisfies a condition. Let's consider a data.frame such as:</p>
  <pre><code>x hour count
  1    0    NA
  2    1    NA
  3    2    NA
  4    3    NA
  5    0    NA
  6    1    NA
  ...
  </code></pre>
  <p>I would like to have this output:</p>
  <pre><code>x hour count
  1    0     1
  2    1    NA
  3    2    NA
  4    3    NA
  5    0     2
  6    1    NA
  ...
  </code></pre>
  <p>With the <code>count</code> column increasing by 1 everytime the condition <code>hour==0</code> is met.
  Is there a smart and efficient way to perform this? Thanks</p>