title: What are some better ways to unstack a large data frame in R?
body: <p>I would like to reshape a data frame of dimensions 103740 x 4 into wide format, i.e., to go from the first block of text below to the second.  The following function works well enough when applied to part of the data frame but it exhausts my machine's available memory when applied to the full data frame: </p>
  
  <pre><code>reshape(analysis1[1:8], idvar=c("name", "sire_name"), 
          timevar = "course", direction = "wide")[, -c(1,2)]  
  </code></pre>
  
  <p>What are some better ways to unstack this data frame?</p>
  
  <pre><code>           name sire_name        course appearance
  1      A Beetoo   Bahhare       Kempton          0
  2      A Beetoo   Bahhare     Lingfield          9
  3      A Beetoo   Bahhare     Southwell          0
  4      A Beetoo   Bahhare Wolverhampton          0
  5 A Bid In Time  Danetime       Kempton          0
  6 A Bid In Time  Danetime     Lingfield          3
  7 A Bid In Time  Danetime     Southwell          2
  8 A Bid In Time  Danetime Wolverhampton          2
  ...
  
    Kempton Lingfield Southwell Wolverhampton
  1       0         9         0             0
  5       0         3         2             2
  ...
  </code></pre>
  
  <p>I've tried moving the data frame into a data table, but just doing this alone doesn't seem to help.</p>