title: Find highest value in duplicated rows - R
body: <p>I have a table of locality, city and number of listings. Some of the locality-city pairings are an error and there is junk data in there. There is a simple algorightm to identify the dummy rows:</p>
  
  <ul>
  <li>If the locality is a repeat; the real city is the one with the highest number of listings. Rest are dummy </li>
  </ul>
  
  <p>I want a clean data frame with the dummy rows removed. </p>
  
  <p>sample data below:</p>
  
  <pre><code>Locality &lt;- c("Aloc", "Bloc", "Cloc", "Dloc", "Aloc", "ALoc", "Bloc", "Bloc", "Bloc", "Cloc",  "Dloc",  "Dloc")
  
  City &lt;- c("A","B","C","D","B","C","A","C","D","D","A","B")
  
  Listings &lt;- c(25,100,150,30,2,1,2,3,2,1,1,1)
  
  l &lt;- data.frame(Locality=Locality, City = City,Listings=Listings )
  </code></pre>
  
  <p>The outcome i want is:</p>
  
  <p><a href="https://i.stack.imgur.com/LIZVy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LIZVy.png" alt="enter image description here"></a></p>