title: Combination of dataframe columns in R
body: <p>I have a data frame that looks like the following:</p>
  
  <pre><code>df &lt;-
  Date  P1 P2 P3 P4
  1/31  5  3  4  5 
  2/28  2  3  7  8 
  3/31  5  6  7  8 
  </code></pre>
  
  <p>I would like to take all combinations, by date, of columns P1...P4, taken 2 at a time -- 4C2. The result would be a list that contains the resultant data frames and will ideally look like this:</p>
  
  <pre><code>[[1]]
  Date  P1 P2
  1/31  5  3  
  2/28  2  3  
  3/31  5  6 
  
  [[2]]
  Date  P1 P3 
  1/31  5  4   
  2/28  2  7   
  3/31  5  7  
  
  .
  .
  .  
  </code></pre>
  
  <p>I'm trying to go about this using the combn() function. I can accomplish the combination by doing </p>
  
  <pre><code>combn(names(df),2,simplify=FALSE) 
  </code></pre>
  
  <p>but this gives me neither the dates nor the values in the result. How should I go about this task?</p>