X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=R%2Freorder.phylo.R;h=e06b26bb44e6a7e9439819d03544c52f4c4971a7;hb=d5b85d181648e2761cecc91d75c4c66fa05e4508;hp=38a7da2e3158a6e516869941ef877a5ff64705ee;hpb=c827059eeafc8cbe41c812b26979543ab287803e;p=ape.git diff --git a/R/reorder.phylo.R b/R/reorder.phylo.R index 38a7da2..e06b26b 100644 --- a/R/reorder.phylo.R +++ b/R/reorder.phylo.R @@ -1,8 +1,8 @@ -## reorder.phylo.R (2007-06-16) +## reorder.phylo.R (2010-04-02) ## Internal Reordering of Trees -## Copyright 2006-2007 Emmanuel Paradis +## Copyright 2006-2010 Emmanuel Paradis ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. @@ -11,9 +11,10 @@ reorder.phylo <- function(x, order = "cladewise", ...) { order <- match.arg(order, c("cladewise", "pruningwise")) if (!is.null(attr(x, "order"))) - if (attr(x, "order") == order) return(x) - nb.tip <- length(x$tip.label) + if (attr(x, "order") == order) return(x) nb.node <- x$Nnode + if (nb.node == 1) return(x) + nb.tip <- length(x$tip.label) nb.edge <- dim(x$edge)[1] neworder <- if (order == "cladewise") .C("neworder_cladewise", as.integer(nb.tip),