title: how to create r matrix or table from data
body: <p>My data format in csv is the following. I would like to create a matrix for heatmap using this file. R gglot i am going to use.</p>
  
  <pre>
  A B     C
  1 apple 3
  2 book  5
  4 bag   1
  9 desk  4
  10 apple 8
  11 book 66
  14 desk 2
  </pre>
  
  <p>I would like to create a matrix for heatmap using that above file.</p>
  
  <pre><code>       1  2  4  9  10  11  14
  apple  3  0  0  0  8   0   0
  book   0  5  0  0  0   66   0
  bag    0  0  1  0  0   0   0
  desk   0  0  0  4  0   0   2
  </code></pre>
  
  <p>i have another column in initial file for ordering. </p>
  
  <pre> 
  A B     C     D
  1 apple 3     4
  2 book  5     1
  4 bag   1     2
  9 desk  4     3
  10 apple 8    4
  11 book 66    1
  14 desk 2     3
  </pre>
  
  <p>how can i order my matrix due to this D ordering column? or i would like to order by sum of 1-14 column.</p>