title: Change rows in a df with rows from another one by a condition R
body: <p>I'd like to know how to change a whole part of a df with rows from another one .</p>
  <p>Here the two dataframes:</p>
  <pre><code>df1 &lt;- data.frame(x = c(1,2,3,4,5,6), y = c(&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, 'e', &quot;f&quot;), z = c(&quot;YES&quot;, &quot;YES&quot;, &quot;YES&quot;, &quot;YES&quot;, &quot;NO&quot;, &quot;NO&quot;))
  
  df2 &lt;- data.frame(x = c(8,9), y = c(&quot;l&quot;, &quot;g&quot;), z = c(&quot;YES&quot;,&quot;YES&quot;))
  </code></pre>
  <p>I want to replace the &quot;YES&quot; rows of df1 with the ones from df2 by 'z' column.</p>
  <pre><code>x y   z
  8 l YES
  9 g YES
  5 e  NO
  6 f  NO
  </code></pre>
  <p>How I can do it?</p>
  <p>Thanks in advance.</p>