title: Use pivot_wider to expand items by response options
body: <p>I´m working with an exam, and I´m trying to get the point-biserial correlation of each response option of each item with the total score of the test.</p>
  <p>To do so, I thought of using pivot wider, so I could extend from something like this:</p>
  <pre><code>math_exam=data.frame(item1=c(&quot;a&quot;,&quot;b&quot;,&quot;a&quot;,&quot;c&quot;,&quot;d&quot;),item2=c(&quot;b&quot;,&quot;b&quot;,&quot;c&quot;,&quot;c&quot;,&quot;a&quot;))
  
    item1 item2 item3
  
  1     a     b     b
  2     b     b     c
  3     a     c     a
  4     c     c     c
  5     d     a     d
  </code></pre>
  <p>Into something more like this:</p>
  <pre><code>      item1.a item1.b item1.c item1.d item2.a item2.b item2.c item2.d
  1       1       0       0       0       0       1       0       0
  2       0       1       0       0       0       1       0       0
  3       1       0       0       0       0       0       1       0
  4       0       0       1       0       0       0       1       0
  5       0       0       0       1       1       0       0       0
  </code></pre>
  <p>If you could recommend any solution either with pivot_longer or any other tool, I would really appreciate it.</p>