title: replacing values in a column with another column R
body: <p>I have two tables in different dimensions, now I want to replace value datA$swl1 with values in datB$swl2 according to userids. </p>
  
  <p>datA </p>
  
  <pre><code> id swl1
   1   0.8
   2   0.7
   3   0.4
   4   0.7
   5   0.0
  </code></pre>
  
  <p>datB</p>
  
  <pre><code>id   swl2
   1   0.8
   3   0.6
   5   0.7
  </code></pre>
  
  <p>output</p>
  
  <p>datA (here swl1 is replaced by the new values in swl2, but not all the ids have a new values, for those that haven't, the original values are retained)</p>
  
  <pre><code> id swl1
   1   0.8
   2   0.7
   3   0.6
   4   0.7
   5   0.7
  </code></pre>
  
  <p>how to do this?</p>