title: R count positive negative numbers and group them by periods in a data frame
body: <p>I have a data set of 365 days that contain one value for temperature respectively.
  I would like to analyse the period of days, that contain positive temperatures and periods that contain negative temperatures. So I want to count the days of a period until the temperature breaks 0. I already set up a column that tracks the algebraic sign, but now I want to add another column that tracks the days that are positive and the days that are negative, so that I can group_by every period and to calculate the mean of Consumption, min, max, etc. 
  I am currently not sure how to draw the result in a plot, but maybe you have an idea..</p>
  
  <pre><code>         Time  Consumption STABW_hour   Min    Max     mean DeltaDaymean  Sign
         &lt;dttm&gt;        &lt;dbl&gt;      &lt;dbl&gt; &lt;dbl&gt;  &lt;dbl&gt;    &lt;dbl&gt;        &lt;dbl&gt; &lt;dbl&gt;
  1  2014-01-01       1053.5   76.56046   964 1597.5 1159.804   -106.30411    -1
  2  2014-01-02       1197.5   76.56046   964 1597.5 1159.804     37.69589     1
  3  2014-01-03       1245.5   76.56046   964 1597.5 1159.804     85.69589     1
  4  2014-01-04       1147.5   76.56046   964 1597.5 1159.804    -12.30411    -1
  5  2014-01-05       1194.0   76.56046   964 1597.5 1159.804     34.19589     1
  6  2014-01-06       1171.5   76.56046   964 1597.5 1159.804     11.69589     1
  7  2014-01-07       1166.5   76.56046   964 1597.5 1159.804      6.69589     1
  8  2014-01-08       1135.0   76.56046   964 1597.5 1159.804    -24.80411    -1
  9  2014-01-09       1168.0   76.56046   964 1597.5 1159.804      8.19589     1
  10 2014-01-10       1181.5   76.56046   964 1597.5 1159.804     21.69589     1
  </code></pre>
  
  <p>The result should be something like this, I would then be able to group_by the data by the new column..</p>
  
  <pre><code>         Time  Consumption STABW_hour   Min    Max     mean DeltaDaymean  Sign Period
         &lt;dttm&gt;        &lt;dbl&gt;      &lt;dbl&gt; &lt;dbl&gt;  &lt;dbl&gt;    &lt;dbl&gt;        &lt;dbl&gt; &lt;dbl&gt;  &lt;dbl&gt;
  1  2014-01-01       1053.5   76.56046   964 1597.5 1159.804   -106.30411    -1      1
  2  2014-01-02       1197.5   76.56046   964 1597.5 1159.804     37.69589     1      2
  3  2014-01-03       1245.5   76.56046   964 1597.5 1159.804     85.69589     1      2
  4  2014-01-04       1147.5   76.56046   964 1597.5 1159.804    -12.30411    -1      3
  5  2014-01-05       1194.0   76.56046   964 1597.5 1159.804     34.19589     1      4
  6  2014-01-06       1171.5   76.56046   964 1597.5 1159.804     11.69589     1      4
  7  2014-01-07       1166.5   76.56046   964 1597.5 1159.804      6.69589     1      4
  8  2014-01-08       1135.0   76.56046   964 1597.5 1159.804    -24.80411    -1      5
  9  2014-01-09       1168.0   76.56046   964 1597.5 1159.804      8.19589     1      6
  10 2014-01-10       1181.5   76.56046   964 1597.5 1159.804     21.69589     1      6
  </code></pre>
  
  <p>Thank you very much!</p>