title: Rename multiple field values in one statement
body: <p>I know that it is possible to do the following:</p>
  
  <pre><code>df$V1[df$V1 == "Y"] &lt;- 1
  </code></pre>
  
  <p>to rename any value that is equal to "Y" to be changed to 1. However what If I had values that equal "N" that I want to change to 0?</p>
  
  <p>I have tried doing this:</p>
  
  <pre><code>df$V1[df$V1 == c("Y","N")] &lt;- c(1,0)
  </code></pre>
  
  <p>but I get a warning</p>
  
  <pre><code>longer object is not a multiple of shorter object
  </code></pre>
  
  <p>which leads to not all values that match case definition to be converted.</p>
  
  <p>what would be the way to do this?</p>