title: Graph / matrix from dataframe by conditiom
body: <p>I have a dataframe like this</p>
  
  <pre><code>df = data.frame(id = c(1,1,1,2,2,2,3,3,3), y=c('a','b', 'b', 'a', 'b', 'c', 
                  'a', 'b', 'd'))
  </code></pre>
  
  <p>I want to get a matrix / graph as below</p>
  
  <pre><code>  a b c d
  a 0 4 1 1
  b 4 0 1 1
  c 1 1 0 0
  d 1 1 0 0
  </code></pre>
  
  <p>where 'a', 'b', 'c', 'd' are levels of df$y and cell is filling by df$id. For example the cell 'a'-'b' = 4 because for id 1 'a' and 'b' intersect twice, for id 2 'a' and 'b' intersect one time, for id 4 'a' and 'b' intersect one time, total 4 times. Etc.... 
  Thanx for any idea... </p>