title: R: Collapse duplicated values in a column while keeping the order
body: <p>I'm sure this is super simple but just can't find the answer. I have a data frame like so</p>
  
  <pre><code>    Id  event
  1   1   A
  2   1   B
  3   1   A
  4   1   A
  5   2   C
  6   2   C
  7   2   A
  </code></pre>
  
  <p>And I'd like to group by <code>Id</code> and collapse the distinct <code>event</code> values while keeping the event order like so</p>
  
  <pre><code>    Id  event
  1   1   A
  2   1   B
  3   1   A
  4   2   C
  5   2   A
  </code></pre>
  
  <p>Most of my searches end up with using the <code>distinct()</code> or <code>unique()</code> functions but that leads losing the <code>A</code> event in row 3 for <code>Id</code> 1. </p>
  
  <p>Thanks in advance! </p>