title: Converting factors to binary in R
body: <p>I am trying to convert a factor variable into binary / boolean (0 or 1).</p>
  
  <p>Sample data:</p>
  
  <pre><code>df  &lt;-data.frame(a = c(1,2,3), b = c(1,1,2), c = c("Rose","Pink","Red"), d = c(2,3,4))
  </code></pre>
  
  <p>Trying to transform it like this: a,b,IsRose,IsPink,IsRed,d</p>
  
  <p><a href="https://i.stack.imgur.com/thrle.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/thrle.jpg" alt="Actuals Vs Expected Result"></a></p>
  
  <p>For that, I tried the following with little success.</p>
  
  <pre><code>library(ade4)
  acm.disjonctif(df)
  </code></pre>