title: Write algorithm to identify symptom pairs
body: <p>Since I'm a new R user, I am struggling with writing a loop or similar to solve the following problem.</p>
  
  <p>So the problem:
  I have a list of 200 patients and 30 symptoms with the info symptom present yes (1) or no (0). I want to create a matrix similar to a correlation matrix, that for every pair of symptoms tells me the percentage of both symptoms being present in the same individuals.</p>
  
  <p>So:</p>
  
  <pre><code>ID /sym 1 / sym 2 / sym 3 /....
  Pat 1 / 1 / 1 / 0 / ...    
  Pat 2 / 1 / 1 / 1 /
  Pat 3 / 1 / 1 / 0 / 
  ...
  </code></pre>
  
  <p>I would then like to use a matrix that looks like a standard correlation matrix, but for every symptom pair show the percentage of both present, since I think that correlating these categorical values does not make any sense.</p>
  
  <p>So far I have started writing for every combination a new variable that tells me if both are present or not, and then used that to calculate the percentage and fill that in my matrix.</p>
  
  <p>Unfortunately that takes FOREVER to write given the amount of combinations possible, but I cant figure out how to iterate through it. Maybe you can help? Its probably very easy and im just not enough of a programmer to think of it.</p>