X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=R%2Freorder.phylo.R;h=e717eb26c2583c6d3cf0e371f289538c851d6ac2;hb=b0d1251527d8dd48ca1703b1cfaf217f413eda0e;hp=ee9e9e0dcf703f7da186d125f82a8f14c26b1758;hpb=fb6a06e39b9c580b39c76fd95e950144e818f45d;p=ape.git diff --git a/R/reorder.phylo.R b/R/reorder.phylo.R index ee9e9e0..e717eb2 100644 --- a/R/reorder.phylo.R +++ b/R/reorder.phylo.R @@ -1,4 +1,4 @@ -## reorder.phylo.R (2012-09-03) +## reorder.phylo.R (2012-10-12) ## Internal Reordering of Trees @@ -13,12 +13,13 @@ reorder.phylo <- function(x, order = "cladewise", index.only = FALSE, ...) io <- pmatch(order, ORDER) if (is.na(io)) stop("ambiguous order") order <- ORDER[io] + nb.edge <- dim(x$edge)[1] if (!is.null(attr(x, "order"))) - if (attr(x, "order") == order) return(x) + if (attr(x, "order") == order) + if (index.only) return(1:nb.edge) else return(x) nb.node <- x$Nnode if (nb.node == 1) return(x) nb.tip <- length(x$tip.label) - nb.edge <- dim(x$edge)[1] if (io == 3) { x <- reorder(x) neworder <-