title: R create adjacency matrix according to columns from data.frame
body: <p>I have a <code>data.frame</code> for 10 videos, and each column is a tag indicating the category of the video. For example, the data will look like this:</p>
  
  <pre><code>data &lt;- data.frame(id=paste0("r", 1:10), A=sample(0:1,10,TRUE), B=sample(0:1,10,TRUE), C=sample(0:1,10,TRUE))
  data
      id A B C
  1   r1 1 0 1
  2   r2 0 0 0
  3   r3 0 1 0
  4   r4 1 1 0
  5   r5 0 0 0
  6   r6 1 0 1
  7   r7 1 0 1
  8   r8 0 1 1
  9   r9 0 0 1
  10 r10 1 0 0
  </code></pre>
  
  <p>Now I would like to form a adjacency matrix based on tags, and the value should be the number of videos with same tags. For example, cell <code>A-C</code> should be 3, because <code>r1</code>, <code>r6</code> and <code>r7</code> have the same tags. Finally, I would like an output matrix like the following:</p>
  
  <pre><code>     A    B    C
  A    5    1    3
  B    1    3    1
  C    3    1    5
  </code></pre>
  
  <p>How could I aggregate the data?</p>