title: Creating similarity matrix of individual lifespans in R
body: <p>I thought this would be really simple, but some googling and looking through the R book has not revealed a ready-made function to achieve this, when I am sure one exists. </p>
  
  <p>I have a vector with 3 columns: individual tag, birth date and death date. I would like to create a square matrix where each cell is the number of days two individuals were both alive.</p>
  
  <p>So from this:</p>
  
  <pre><code>ID Birth Death
  A    1/5    5/5
  B    2/5   30/5
  C   10/5   31/5
  </code></pre>
  
  <p>To this:</p>
  
  <pre><code>    A    B    C
  A   4    3    0
  B   3   28   20
  C   0   20   21
  </code></pre>
  
  <p>What the diagonal (so self-overlap) is is largely irrelevant as during analyses later I can ignore it.</p>
  
  <p>Cheers for any help</p>