title: Create sequence based on grouping variable in R
body: <p>I'm looking for a way to create a sequence of numbers ($C) that ascend every time a string changes in($A). This is contingent on a grouping variable ($B).
  Example:</p>
  
  <pre><code>A    B C
  a1   1 1
  a1   1 1
  a1   1 1
  a10  1 2
  a10  1 2
  a2   1 3
  a1   2 1
  a20  2 2
  a30  2 3
  </code></pre>