title: How to label consecutive data points (clusters) as different groups
body: <p>I'd like to label the consecutive data points of same property (in this example &quot;TRUE&quot;) as different groups (e.g., Group1, Group2, ...).</p>
  <p>Below is the example data:</p>
  <pre><code>dt &lt;- data.frame(value = c(TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE))
  </code></pre>
  <p>The &quot;group&quot; column is what I want to achive:</p>
  <pre><code> value group
    TRUE    G1
    TRUE    G1
   FALSE  &lt;NA&gt;
   FALSE  &lt;NA&gt;
    TRUE    G2
   FALSE  &lt;NA&gt;
    TRUE    G3
    TRUE    G3
    TRUE    G3
    TRUE    G3
  </code></pre>