title: R: two data frame merge
body: <p>I want to merge two data frame, but there are some row names repeated.
  If the numbers of row name in two data frame are different, I hope the it can show &quot;NA&quot; in the less one column.</p>
  <p>My example:</p>
  <pre><code>test1 &lt;- data.frame(name = c(&quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;C&quot;, &quot;C&quot;, &quot;D&quot;), n1 = c(&quot;15&quot;, &quot;14&quot;, &quot;13&quot;, &quot;12&quot;, &quot;11&quot;, &quot;10&quot;))
  test2 &lt;- data.frame(name = c(&quot;A&quot;, &quot;B&quot;, &quot;B&quot;, &quot;C&quot;, &quot;C&quot;, &quot;D&quot;), n1 = c(&quot;30&quot;, &quot;31&quot;, &quot;33&quot;, &quot;39&quot;, &quot;38&quot;, &quot;40&quot;)) 
  </code></pre>
  <p>Then I merge by name, I got</p>
  <blockquote>
  <p>name n1.x n1.y</p>
  <pre><code>A   15   30 
  B   14   31
  B   14   33
  C   13   39
  C   13   38
  C   12   39
  C   12   38
  C   11   39
  C   11   38
  D   10   40
  </code></pre>
  </blockquote>
  <p>It will repeating
  What I want to is</p>
  <blockquote>
  <p>name n1.x n1.y</p>
  <pre><code>A   15   30 
  B   14   31
  B   NA   33
  C   13   39
  C   12   38
  C   11   NA
  D   10   40
  </code></pre>
  </blockquote>
  <p>What Command should I use?
  Thank you very much!</p>