title: Using the spread function correctly
body: <p>My data "IDrel" has three variables, "ID", "category" and "value", it looks something like this:</p>
  
  <pre><code>    ID  category value
  1       AU: Duflo, Esther
  2   2   AF: MIT
  3   3   SO: American Economic Journal: Applied Economics, 2(2), April 2010, pp.
  4   4   IS: 1945-7782
  5   5   AV: http://www.aeaweb.org/aej-applied/
  6   6   DT: Journal Article
  7   7   PY: 2010
  8   8   AN: 1094392
  9   9   TI: Prize Structure and Information in Tournaments: Experimental Evidence
  10  10  AU: Freeman, Richard B.; Gelber, Alexander M.
  11  11  AF: NBER; NBER
  12  12  SO: American Economic Journal: Applied Economics, 2
  </code></pre>
  
  <p>There are 9 unique values of "category", and I want to make each of them into their own variable, with values represented by the "value"-variable. In theory, this should increase the number of variables to 11 and reduce the number of observations by something like 9/10. </p>
  
  <p>The desired output looks something like this:</p>
  
  <pre><code>ID    AU:            SO.                           IS:          [more variables]
  
      1     Duflo, Esther   American Economic Journal    1945-7782    [more values]
      2     Freeman, Richard American Economic Journal:  [...]     
  </code></pre>
  
  <p>I try to achieve this via the spread-function:</p>
  
  <pre><code>IDspread&lt;-spread(IDrel, category, value)
  </code></pre>
  
  <p>I actually do get 11 variables, but I get the same number of observations. The results seem nonsensical to me, these are the first 10 observations:</p>
  
  <pre><code>IS:  PY:
  1      &lt;NA&gt; &lt;NA&gt;
  2      &lt;NA&gt; &lt;NA&gt;
  3      &lt;NA&gt; &lt;NA&gt;
  4 1945-7782 &lt;NA&gt;
  </code></pre>
  
  <p>Am I using this function correctly? Is there an alternative?</p>
  
  <p>I realize the ID variable doesn't reflect which category/value belongs with which observation, but I need to reorder the data in order to "get" the correct index for each observation ^^   </p>