title: Reframing magic on data.frame
body: <p>I am currently learning to work with data.frame and quite confused on how to reorder them.</p>
  
  <p>At the moment, I have a data.frame that shows :</p>
  
  <ul>
  <li>column 1: a shop name</li>
  <li>column 2: a product</li>
  <li>column 3: the number of purchase for this product by this shop</li>
  </ul>
  
  <p>or visually something like this:</p>
  
  <pre><code>+---+-----------+-------+----------+--+
  |   | Shop.Name | Items | Product  |  |
  +---+-----------+-------+----------+--+
  | 1 | Shop1     |     2 | Product1 |  |
  | 2 | Shop1     |     4 | Product2 |  |
  | 3 | Shop2     |     3 | Product1 |  |
  | 4 | Shop3     |     2 | Product1 |  |
  | 5 | Shop3     |     1 | Product4 |  |
  +---+-----------+-------+----------+--+
  </code></pre>
  
  <p>What I would like to achieve is the following "shop-centric" structure:</p>
  
  <ul>
  <li>column 1: a shop name</li>
  <li>column 2: Items sold for product1</li>
  <li>column 3: Items sold for product2</li>
  <li>column 4: Items sold for product3
  ...</li>
  </ul>
  
  <p>When there is no line for a specific shop/product (because of no sales), I would like to create a 0.</p>
  
  <p>or </p>
  
  <pre><code>+---+-------+-------+-------+-------+-------+-----+--+--+
  |   | Shop  | Prod1 | Prod2 | Prod3 | Prod4 | ... |  |  |
  +---+-------+-------+-------+-------+-------+-----+--+--+
  | 1 | Shop1 |     2 |     4 |     0 |     0 | ... |  |  |
  | 2 | Shop2 |     3 |     0 |     0 |     0 | ... |  |  |
  | 3 | Shop3 |     2 |     0 |     0 |     1 | ... |  |  |
  +---+-------+-------+-------+-------+-------+-----+--+--+
  </code></pre>