title: How to replace certain records in a table with another table using "merge"?
body: <p>I want to replace "O" in table t1 with table t2 using "merge":</p>
  
  <pre><code>t1&lt;-data.frame(x1=c(1,2,3,4,5),x2=c("a","O","O","b","a"))
  t2&lt;-data.frame(x1=c(2,3),x2=c("a","b"))
  first &lt;- merge(t1["x2"=="O",],t2,by="x1")
  </code></pre>
  
  <p>The result was supposed to be like this：</p>
  
  <pre><code>t1&lt;-data.frame(x1=c(1,2,3,4,5),x2=c("a","a","b""b","a"))
  </code></pre>
  
  <p>But I didn't get it.</p>
  
  <p>What's the problem?</p>