title: Indexing repeated elements in a vector
body: <p>I would like to take a vector:</p>
  
  <pre><code>x &lt;- c(rep("cat",3), rep("dog",2))
  
  [1] "cat" "cat" "cat" "dog" "dog"
  </code></pre>
  
  <p>and turn it into:</p>
  
  <pre><code>[1] "cat_a" "cat_b" "cat_c" "dog_a" "dog_b"
  </code></pre>
  
  <p>Where each unique element is index with "_" plus a letter.</p>