]> git.donarmstrong.com Git - ape.git/blobdiff - R/reorder.phylo.R
various corrections
[ape.git] / R / reorder.phylo.R
index 38a7da2e3158a6e516869941ef877a5ff64705ee..e06b26bb44e6a7e9439819d03544c52f4c4971a7 100644 (file)
@@ -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),