title: Merge is duplicating rows in r
body: <p>I have two data sets with country names in common. </p>
  
  <p><a href="https://i.stack.imgur.com/IDVOF.png" rel="nofollow noreferrer">first data frame</a></p>
  
  <p>As you can see, both data sets have a two letter country code formated the same way. </p>
  
  <p>After running this code:
      merged&lt;- merge(aggdata, Trade, by="Group.1" , all.y = TRUE, all.x=TRUE)</p>
  
  <p><a href="https://i.stack.imgur.com/jbgl9.png" rel="nofollow noreferrer">I get the following result</a></p>
  
  <p>Rather than having 2 rows with the same country code, I'd like them to be combine. </p>
  
  <p>Thanks!</p>