title: R- combining two data frames by replacing common referenced values
body: <p>Let I have such data frames(df1 and df2):</p>
  
  <p>df1</p>
  
  <pre><code>ID  y
  4   12
  2   65
  3   7
  5   878
  1   1
  7   122
  </code></pre>
  
  <p>df2</p>
  
  <pre><code>ID  z
  
  2   90
  5   16
  1   22
  </code></pre>
  
  <p>In df2 the ID's are also avaible in df1. Namely df2 is subset of df1 in terms of ID column.</p>
  
  <p>I want create a new data frame(df3) such that</p>
  
  <pre><code>ID  y
  4   12
  2   90
  3   7
  5   16
  1   22
  7   122
  </code></pre>
  
  <p>Namely, in df1 y values are replaced with z values in df2 for the common ID's.</p>
  
  <p>How can  do that using R? I will be vet glad for any help. Thanks a lot.</p>