title: Creating a table with individual trials from a frequency table in R (inverse of table function)
body: <p>I have a frequency table of data in a <code>data.frame</code> in R listing factor levels and counts of successes and failures. I would like to turn it from frequency table into a list of events - i.e. the <em>opposite</em> of the "table" command. Specifically, I would like to turn this:</p>
  
  <pre><code>factor.A factor.B success.count fail.count
  -------- -------- ------------- ----------
   0        1        0             2
   1        1        2             1
  </code></pre>
  
  <p>into this:</p>
  
  <pre><code>factor.A factor.B result 
  -------- -------- -------
   0        1        0
   0        1        0
   1        1        1
   1        1        1
   1        1        0
  </code></pre>
  
  <p>It seems to me that <code>reshape</code> ought to do this, or even some obscure base function that I have not heard of, but I've had no luck. Even repeating individual rows of a <code>data.frame</code> is tricky - how do you pass a variable number of arguments to <code>rbind</code>?</p>
  
  <p>Tips?</p>
  
  <p>Background:
  Why? Because it it easier to cross-validate logistic fits to such a data set than the aggregated binomial data.</p>
  
  <p>I'm analysing my with a generalised linear model as binomial regression in R and would like to cross validate  to control regularisation of my data since my purpose is predictive.</p>
  
  <p>However, as far as I can tell, the default cross validation routines in R are not great for binomial data, simply skipping entire rows of the frequency table, rather than trials individually. This means that lightly and heavily sampled factor combinations have the same weight in my cost function, which is inappropriate for my data.</p>