title: Why are the keys not spread across multiple columns?
body: <p>I am trying to spread the key-values of the 'Type' column across multiple columns. The dataframe (dat_weighted) is as follows:</p>
  
  <pre><code>  AreaName             Type index_disagg_standard index Category
  1 Barking and Dagenham MRF  0.3329420             0.518 Average
  2 Barking and Dagenham SDH  0.5286273             0.518 Average
  3 Barking and Dagenham HO   0.7096024             0.518 Average
  4 Barnet               MRF  0.8639524             0.750 Average
  5 Barnet               SDH  0.3641302             0.750 Average
  6 Barnet               HO   0.8493885             0.750 Average
  7 Barnsley             MRF  0.5628280             0.610 Average
  8 Barnsley             SDH  0.801927              0.610 Average
  9 Barnsley             HO   0.4823344             0.610 Average
  </code></pre>
  
  <p>The code I have tried is as follows :</p>
  
  <pre><code>dat_index &lt;- dat_weighted %&gt;%
    distinct(AreaName, .keep_all = TRUE) %&gt;%
    arrange(index) %&gt;%
    spread(key = Type, value = index_disagg_standard)
  </code></pre>
  
  <p>But it only provides me with this:</p>
  
  <pre><code>  AreaName             MRF         index
  1 Barking and Dagenham 0.33294203  0.518
  2 Barnet               0.86395241  0.750
  3 Barnsley             0.56282804  0.610
  </code></pre>
  
  <p>and I would be expecting something like this:</p>
  
  <pre><code>  AreaName             MRF         SDH       OH        index
  1 Barking and Dagenham 0.33294203  0.5286273 0.7096024 0.518
  2 Barnet               0.86395241  0.3641302 0.8493885 0.750    
  3 Barnsley             0.56282804  0.801927  0.4823344 0.610
  </code></pre>