title: How to identify consecutive observations based on time steps?
body: <p>I would like to identify if an activity occurs consecutive times and how often during a week. The starting point is t1 that records the occurrence of an activity at t1_1 , t1_2, t1_3 and so on. For example in the case of id 12 activity occurred at t1_2, t1_3, t2_2, t3_1, t3_3, t4_2, t5_2, t6_1, t6_2, t6_3 and t7_3. As here was reported activity during all 7 days I assume the activity occurred consecutively. I would like to identify all id's in which an activity occured consecutively and the sum of occurrence.</p>
  
  <p>Input</p>
  
  <pre><code>id t1_1 t1_2 t1_3 t2_1 t2_2 t2_3 t3_1 t3_2 t3_3 t4_1 t4_2 t4_3 t5_1 t5_2 t5_3 t6_1 t6_2 t6_3 t7_1 t7_2 t7_3
  12  0    1     1    0     1   0    1    0    1    0    1    0    0    1    0     1   1     1   0      0  1
  123 0    0     0    1     1   1    0    0    0    1    1    1    1    1    1     0   0     0    1     1  1
   10  1   1     1    1     1    1    1   1    1    1    1    1    1    1    1     1   1     1    1     1  1   
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>Id   Sum 
  12    11
  10    21
  </code></pre>