title: R - Select specific rows within group of rows
body: <p>I have a dataframe like the following one:</p>
  
  <pre><code>     ID          STATUS
  1638483        Very bad
  1407499       Very good
  1383920            Good
  1407499             Bad
  </code></pre>
  
  <p>First  column contains <code>ID</code>, some are unique but some others are not.<br>
  Second column contains <code>STATUS</code> which can be: <code>"Very good"</code>, <code>"Good"</code>, <code>"Bad"</code>, or <code>"Very Bad"</code>.</p>
  
  <p>I'd like to:</p>
  
  <ul>
  <li><strong>keep rows with unique <code>ID</code> (<code>STATUS</code> does not matter here)</strong>: rows with <code>ID</code> <code>1638483</code> or <code>1383920</code>  for example,</li>
  <li><strong>select only rows with the best status for rows with non-unique <code>ID</code></strong>: rows with <code>ID</code> <code>1407499</code> for example</li>
  </ul>
  
  <p>The desired output would be:</p>
  
  <pre><code>     ID          STATUS
  1638483        Very bad
  1407499       Very good
  1383920            Good
  </code></pre>
  
  <p>I tried to use the <code>dplyr</code> package. 
  I succeed to group data by <code>ID</code> but then I'm stuck.</p>