title: Adding the first, second, third observation in a data frame
body: <p>I am working with a dataset containing serial numbers. I would like to add a column that defines if it is the first, second or nth time that the serial number occurs. For example:</p>
  <pre><code>serial   occurrence
     110            1
     111            1
     112            1
     110            2
     110            3
  </code></pre>