title: Convert data frame common rows to columns
body: <p>Say I have a data frame where one column is some repeating value (dates, IDs, etc).  Is there a way to convert a data frame into a now data frame with columns instead of replicating rows?  Basically I want to transpose something like this:</p>
  
  <pre><code>col1 col2 col3
  1    aa   30
  2    aa   40
  3    aa   10
  1    bb   20
  2    bb   12
  3    bb   15
  1    cc   40
  2    cc   31
  3    cc   12
  </code></pre>
  
  <p>Into this:</p>
  
  <pre><code>    aa   bb   cc
  1   30   20   40
  2   40   12   31
  3   10   15   12
  </code></pre>
  
  <p>Here is some code that makes a sample of the first data frame:</p>
  
  <pre><code>a &lt;- c(rep(1:10, 3))
  b &lt;- c(rep("aa", 10), rep("bb", 10), rep("cc", 10))
  set.seed(123)
  c &lt;- sample(seq(from = 20, to = 50, by = 5), size = 30, replace = TRUE)
  d &lt;- data.frame(a,b, c)
  </code></pre>
  
  <p>I am unsure how to transpose it.</p>