title: R: assign incremental numbers to rows containing a same label
body: <p>Given a dataframe <code>df</code> as follows:</p>
  
  <pre><code>chrom   position    strand  value   label
   chr1      17432         -      0   romeo
   chr1      17433         -      0   romeo
   chr1      17434         -      0   romeo
   chr1      17435         -      0   romeo
   chr1      17409         -      1  juliet
   chr1      17410         -      1  juliet
   chr1      17411         -      1  juliet
  </code></pre>
  
  <p>For each group of labels, I would like to number the lines that share the same <code>label</code> starting from 1 and put those numbers in a new column. (I don't just want to count them, the goal is to number them). The output should look something like this:</p>
  
  <pre><code>chrom   position    strand  value   label  number
   chr1      17432         -      0   romeo       1
   chr1      17433         -      0   romeo       2
   chr1      17434         -      0   romeo       3
   chr1      17435         -      0   romeo       4
   chr1      17409         -      1  juliet       1
   chr1      17410         -      1  juliet       2
   chr1      17411         -      1  juliet       3
  </code></pre>
  
  <p>Is there a function or package that does the job?</p>