X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=R%2Fis.ultrametric.R;h=ae4c43937ea6f08ea6a8cae0afcf7d40a684195a;hb=2419de65ffb4f7c45eb8c2448bcba3d0df64744f;hp=476c229c0d46045dafa53e94e176d2d0bec4bc4b;hpb=c827059eeafc8cbe41c812b26979543ab287803e;p=ape.git diff --git a/R/is.ultrametric.R b/R/is.ultrametric.R index 476c229..ae4c439 100644 --- a/R/is.ultrametric.R +++ b/R/is.ultrametric.R @@ -1,19 +1,19 @@ -## is.ultrametric.R (2007-12-18) +## is.ultrametric.R (2009-05-10) ## Test if a Tree is Ultrametric -## Copyright 2003-2007 Emmanuel Paradis +## Copyright 2003-2009 Emmanuel Paradis ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. is.ultrametric <- function(phy, tol = .Machine$double.eps^0.5) { -### the tree must be in cladewise order - 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.") + phy <- reorder(phy) n <- length(phy$tip.label) n.node <- phy$Nnode