title: Plot a tree in R given pairs of leaves and heights where they merge
body: <p>I have a list of leaves in a tree and the height at which I'd like them to merge, i.e. the height of their most recent common ancestor. All leaves are assumed to be at height 0. A toy example might look like:</p>
  
  <pre><code>as.data.frame(rbind(c("a","b",1),c("c","d",2),c("a","d",4)))
     V1 V2 V3
  1  a  b  1
  2  c  d  2
  3  a  d  4
  </code></pre>
  
  <p>I want to plot a tree representing this data. I know that R can plot trees coming from <code>hclust</code>. How do I get my data into the format returned by <code>hclust</code> or into some other format that is easily plotted?</p>
  
  <p><strong>Edited to add diagram:</strong></p>
  
  <p>The tree for the above dataset looks like this:</p>
  
  <pre><code>   __|___
    |      |
    |     _|_
   _|_   |   |
  |   |  |   |  
  a   b  c   d   
  </code></pre>