[Phylobase-commits] r381 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Dec 21 05:36:53 CET 2008


Author: pdc
Date: 2008-12-21 05:36:53 +0100 (Sun, 21 Dec 2008)
New Revision: 381

Modified:
   pkg/R/methods-phylo4d.R
Log:
update the phylo4d method as well

Modified: pkg/R/methods-phylo4d.R
===================================================================
--- pkg/R/methods-phylo4d.R	2008-12-21 04:33:57 UTC (rev 380)
+++ pkg/R/methods-phylo4d.R	2008-12-21 04:36:53 UTC (rev 381)
@@ -177,12 +177,14 @@
 })
 
 setMethod("reorder", signature(x = 'phylo4d'), function(x, order = 'cladewise') {
-        index <- orderIndex(x, order)
-        test <<- index
-        x at edge      <- x at edge[index, ]
-        x at tip.data  <- x at tip.data[index[index <= nTips(x)], , drop = FALSE]
-        x at node.data <- x at node.data[index[index > nTips(x)], , drop = FALSE]
-        if(hasEdgeLabels(x)) { x at edge.label  <- x at edge.label[index] }
-        if(hasEdgeLength(x)) { x at edge.length <- x at edge.length[index] }
-        x
-    })
+    ## call orderIndex and use that index to order edges, labels and lengths
+    order       <- match.arg(order)
+    index       <- orderIndex(x, order)
+    x at order     <- order
+    x at edge      <- x at edge[index, ]
+    x at tip.data  <- x at tip.data[index[index <= nTips(x)], , drop = FALSE]
+    x at node.data <- x at node.data[index[index > nTips(x)], , drop = FALSE]
+    if(hasEdgeLabels(x)) { x at edge.label  <- x at edge.label[index] }
+    if(hasEdgeLength(x)) { x at edge.length <- x at edge.length[index] }
+    x
+})



More information about the Phylobase-commits mailing list