title: Counting which products have been bought together
body: <p>I have a DF like this:</p>
  
  <pre><code>ID Product
  1  1
  1  2
  2  2
  2  3
  2  4
  3  1
  3  2
  4  3
  </code></pre>
  
  <p>Now I need in R a possibility like here:</p>
  
  <p><a href="https://stackoverflow.com/questions/18578216/finding-products-that-customers-bought-together">finding products that customers bought together</a></p>
  
  <p>My output should look like this:</p>
  
  <pre><code>ProductX ProductY Times
  1        2        2
  2        3        1
  3        4        1
  </code></pre>
  
  <p>Nice would be a matrix output lile this:</p>
  
  <pre><code>      [,1] [,2] [,3] [,4] 
  [1,]    1    2    0    0    
  [2,]    2    1    1    0    
  [3,]    0    0    1    1    
  [4,]    0    0    1    1
  </code></pre>
  
  <p>I have tried it with the reshape2 package but I don't know how to get this output form.</p>