title: Is there in R to find out multiple duplicated codes and keep one of them?
body: <p>I have the following data</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>df1 &lt;- read.table(text = " ID Location Place
  12 A M2
  11 C M2
   13 M M1
  12 B M2
  11 C M2
  4 D M2
  15 Z M1
   13 M M1
  15 Q M1
  ", header = TRUE)</code></pre>
  </div>
  </div>
  </p>
  
  <p>I want to keep both IDs if the locations are different. If the IDs and The location is the same, I want to remove one them. So the desirable outcome would be:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>ID Location Place
  12 A M2
  12 B M2
  11 C M2
  13 M M1
  4 D M2
  15 Z M1
  15 Q M1</code></pre>
  </div>
  </div>
  </p>
  
  <p>I have tried the following codes, but it does not produce the outcome of intrest</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>library(dplyr)
  df1 %&gt;% distinct(ID, .keep_all = TRUE)</code></pre>
  </div>
  </div>
  </p>
  
  <p>Is it possible to get the outcome?Thanks for your help </p>