title: Merge: ‘NA’, ‘NA’ are duplicated in the result
body: <p>I am looking at the sample code from this link.</p>
  
  <p><a href="http://www.milanor.net/blog/maps-in-r-plotting-data-points-on-a-map/" rel="nofollow noreferrer">http://www.milanor.net/blog/maps-in-r-plotting-data-points-on-a-map/</a></p>
  
  <p>It seems like the data set locations have changes, so I changed my code, just slightly, to accommodate.</p>
  
  <pre><code>airports &lt;- read.delim("https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat", sep=",")
  colnames(airports) &lt;- c("ID", "name", "city", "country", "IATA_FAA", "ICAO", "lat", "lon", "altitude", "timezone", "DST")
  head(airports)
  
  library(rworldmap)
  newmap &lt;- getMap(resolution = "low")
  plot(newmap, xlim = c(-20, 59), ylim = c(35, 71), asp = 1)
  points(airports$lon, airports$lat, col = "red", cex = .6)
  
  
  
  routes &lt;- read.csv("https://raw.githubusercontent.com/jpatokal/openflights/master/data/routes.dat", header=F)
  colnames(routes) &lt;- c("airline", "airlineID", "sourceAirport", "sourceAirportID", "destinationAirport", "destinationAirportID", "codeshare", "stops", "equipment")
  head(routes)
  
  library(plyr)
  departures &lt;- ddply(routes, .(sourceAirportID), "nrow")
  names(departures)[2] &lt;- "flights"
  arrivals &lt;- ddply(routes, .(destinationAirportID), "nrow")
  names(arrivals)[2] &lt;- "flights"
  </code></pre>
  
  <p>All of this seems fine.  The code below seems to be off, but I'm not sure why.</p>
  
  <pre><code>airportD &lt;- merge(airports, departures, by.x = "ID", by.y = "sourceAirportID")
  airportA &lt;- merge(airports, arrivals, by.x = "ID", by.y = "destinationAirportID")
  </code></pre>
  
  <p>I'm getting this error:</p>
  
  <blockquote>
    <p>Warning message: 
    In merge.data.frame(airports, departures, by.x =
    "ID", by.y = "sourceAirportID") :   column names ‘NA’, ‘NA’ are
    duplicated in the result</p>
    
    <p>Warning message: 
    In merge.data.frame(airports, arrivals, by.x = "ID", by.y =
    "destinationAirportID") :   column names ‘NA’, ‘NA’ are duplicated in
    the result</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>