title: Is there a possibility to merge 2 dataframes in R, keeping only unique results with one of the columns as the dependency for which results are kept
body: <p>I know the question is confusing, but I don't know how to formulate it better. I have 11 xls lists that contain GOTerm IDS in the format</p>
  <pre><code>ID   Category   Colour
  </code></pre>
  <p>These lists all in all contain about 130k IDS however, only 26k of those are unique.</p>
  <p>I built a ranking of the 11 lists by category. What I need now is a way to merge List 11 with List 10 and for any ID that is in both lists, I want to keep the ID with the lower category number (in this example category 10) and the matching colour.</p>
  <p>Preferably I'd like to do this in one script/ combined lines of code for all lists.</p>
  <p>Example</p>
  <p>List11</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>ID</th>
  <th>Category</th>
  <th>colour</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>Category11</td>
  <td>red</td>
  </tr>
  <tr>
  <td>2</td>
  <td>Category11</td>
  <td>red</td>
  </tr>
  <tr>
  <td>3</td>
  <td>Category11</td>
  <td>red</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>List10</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>ID</th>
  <th>Category</th>
  <th>colour</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>Category10</td>
  <td>blue</td>
  </tr>
  <tr>
  <td>2</td>
  <td>Category10</td>
  <td>blue</td>
  </tr>
  <tr>
  <td>4</td>
  <td>Category10</td>
  <td>blue</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>And my ideal merged result would look like this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>ID</th>
  <th>Category</th>
  <th>colour</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>Category10</td>
  <td>blue</td>
  </tr>
  <tr>
  <td>2</td>
  <td>Category10</td>
  <td>blue</td>
  </tr>
  <tr>
  <td>3</td>
  <td>Category11</td>
  <td>red</td>
  </tr>
  <tr>
  <td>4</td>
  <td>Category10</td>
  <td>blue</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>And then the same thing for the new list vs. List 9, that result vs list 8 and so on</p>