title: R: ape/phylobase: unable to convert ultrametric, binary tree to hclust object (warning message)
body: <p>I've imported a ClustalW2 tree in R using the ape function and <code>read.tree</code> function of the ape package. I estimate molecular ages using the chronopl function, resulting in a ultrametric, binary tree. From which I want to create a R build in dendrogram object. </p>
  
  <p>The tree plots fine, and is a real phylo object. However i'm running into problems when trying to convert it:</p>
  
  <p><strong>Minimal Working Example:</strong></p>
  
  <pre><code>require(ape)
  test.tree &lt;- read.tree(file = "testree.phylip", text = NULL, tree.names = NULL, skip = 0,
      comment.char = "#", keep.multi = FALSE)
  
  test.tree.nu &lt;- chronopl(test.tree, 0, age.min = 1, age.max = NULL,
  node = "root", S = 1, tol = 1e-8,
  CV = FALSE, eval.max = 500, iter.max = 500)
  
  is.ultrametric(test.tree.nu)
  is.binary.tree(test.tree.nu)
  treeclust &lt;- as.hclust.phylo(test.tree.nu)
  </code></pre>
  
  <p>The resulting tree "looks" fine,
  I test to make sure the tree is not ultrametric and binary, and want to convert it into a hclust object, to make eventually a dendrogram object of it.</p>
  
  <pre><code>&gt; is.binary.tree(test.tree.nu)
  [1] TRUE
  &gt; is.ultrametric(test.tree.nu)
  [1] TRUE
  </code></pre>
  
  <p>After trying to make a hclust object out of the tree, I get an error:</p>
  
  <pre><code>&gt; tree.phylo &lt;- as.hclust.phylo(test.tree.nu)
  Error in if (tmp &lt;= n) -tmp else nm[tmp] : 
    missing value where TRUE/FALSE needed
  In addition: Warning message:
  In nm[inode] &lt;- 1:N :
    number of items to replace is not a multiple of replacement length
  </code></pre>
  
  <p>I realize this is a very detailed question, and perhaps such questions which are specifically related to certain packages are better asked somewhere else, but I hope someone is able to help me.</p>
  
  <p>All help is much appreciated,</p>
  
  <p>Regards,</p>
  
  <p><strong>File download</strong></p>
  
  <p>The Phylip file can be downloaded here 
  <a href="http://www.box.net/shared/rnbdk973ja" rel="nofollow">http://www.box.net/shared/rnbdk973ja</a></p>