title: How to convert a vector into a matrix by using two indices?
body: <p>I have a data set look like this:</p>
  
  <pre><code>a&lt;-c(1,1,1,2,2,2,3,3,3)
  b&lt;-rep(1:3,3)
  c&lt;-c(rep(c("i","j","k","l"),2),"o")
  d&lt;-data.frame(a,b,c)
  </code></pre>
  
  <p>which gives:</p>
  
  <pre><code>  a b c
  1 1 1 i
  2 1 2 j
  3 1 3 k
  4 2 1 l
  5 2 2 i
  6 2 3 j
  7 3 1 k
  8 3 2 l
  9 3 3 o
  </code></pre>
  
  <p>I am looking for a way to transform c into the following form:</p>
  
  <pre><code>  1 2 3
  1 i j k
  2 l i j
  3 k l o
  </code></pre>
  
  <p>So basically I hope to use <code>a</code> as the row index, <code>b</code> as column index, then transform the column <code>c</code> to a matrix. Is there any way this could be done efficiently by using data.table or other packages?</p>
  
  <p>Thanks a lot guys!</p>