]> git.donarmstrong.com Git - ape.git/blobdiff - R/vcv.phylo.R
several bug fixes while in JKT
[ape.git] / R / vcv.phylo.R
index 09e4dc3248bb4b356cce6b585ac1c160e976c93e..01cbff7827fd6c74547e12ae6f32b12545cb586a 100644 (file)
@@ -1,15 +1,15 @@
-## vcv.phylo.R (2006-10-04)
+## vcv.phylo.R (2009-07-06)
 
 ##   Phylogenetic Variance-Covariance or Correlation Matrix
 
-## Copyright 2002-2006 Emmanuel Paradis
+## Copyright 2002-2009 Emmanuel Paradis
 
 ## This file is part of the R-package `ape'.
 ## See the file ../COPYING for licensing issues.
 
 vcv.phylo <- function(phy, model = "Brownian", cor = FALSE)
 {
-    if (class(phy) != "phylo")
+    if (!inherits(phy, "phylo"))
       stop('object "phy" is not of class "phylo"')
     if (is.null(phy$edge.length))
       stop("the tree has no branch lengths")
@@ -37,6 +37,7 @@ vcv.phylo <- function(phy, model = "Brownian", cor = FALSE)
         }
     }
 
+    phy <- reorder(phy)
     n <- length(phy$tip.label)
     n.node <- phy$Nnode
     N <- n.node + n