title: Change value of variable with dplyr
body: <p>I regularly need to change the values of a variable based on the values on a different variable, like this:</p>
  
  <pre><code>mtcars$mpg[mtcars$cyl == 4] &lt;- NA
  </code></pre>
  
  <p>I tried doing this with <code>dplyr</code> but failed miserably:</p>
  
  <pre><code>mtcars %&gt;%
  mutate(mpg = mpg == NA[cyl == 4]) %&gt;%
  as.data.frame()
  </code></pre>
  
  <p>How could I do this with <code>dplyr</code>?</p>