title: dplyr mutate converting "No" to 0 and "Yes" to 1
body: <p>I have a column of type <code>chr</code> that I need as boolean (but leaving the NAs as NAs). The desired conversion is: No = 0, Yes = 1, NA = NA</p>
  
  <pre><code>tmp &lt;- tibble(x = 1:7, y = c("No", "Yes", NA, "Yes", "Yes", "Yes", "No"))
  </code></pre>
  
  <p>I used the following to mutate; however I don't want a new variable but just change the original <code>y</code> variable:</p>
  
  <pre><code>tmp = tmp %&gt;% mutate(
   z = case_when(
       y=="No" ~ 0,
       y=="Yes" ~ 1
   ))
  </code></pre>