title: Transforming observations into variables
body: <p>I have a data of the format:</p>
  
  <pre><code>|id|genre1|genre2 |genre3 |
  |1 |action|comedy |romance|
  |2 |comedy|romance|       |
  |3 |romance|      |       |
  </code></pre>
  
  <p>I want to convert my data to be of the format:</p>
  
  <pre><code>|id|action|comedy|romance|
  |1 |1     |1     |1      |
  |2 |0     |1     |1      |
  |3 |0     |0     |1      |
  </code></pre>
  
  <p>What is the best way of doing this?</p>