[Phylobase-commits] r398 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 22 22:51:40 CET 2008


Author: bbolker
Date: 2008-12-22 22:51:40 +0100 (Mon, 22 Dec 2008)
New Revision: 398

Modified:
   pkg/R/methods-phylo4.R
Log:
  make labels() report in nodeId order [by translating from
underlying edge-matrix order: will need to change if underlying
architecture changes!]



Modified: pkg/R/methods-phylo4.R
===================================================================
--- pkg/R/methods-phylo4.R	2008-12-22 04:51:00 UTC (rev 397)
+++ pkg/R/methods-phylo4.R	2008-12-22 21:51:40 UTC (rev 398)
@@ -116,10 +116,10 @@
     "node", "allnode"), ...) {
     which <- match.arg(which)
     switch(which,
-            tip = object at tip.label,
+            tip = object at tip.label[order(nodeId(object,"tip"))],
             node = {
                 if (hasNodeLabels(object)) {
-                    object at node.label
+                    object at node.label[order(nodeId(object))]
                 }
                 else
                 {
@@ -135,8 +135,11 @@
                 {
                     nl <- rep(NA,nNodes(object))
                 }
-                c(object at tip.label,nl)
-            }
+                ## lorder <- match(object at edge[,2],
+                ## c(nodeId(object,"tip"),nodeId(object)))
+                lorder <- order(c(nodeId(object,"tip"),nodeId(object)))
+                c(object at tip.label,nl)[lorder]
+              }
             )
 })
 



More information about the Phylobase-commits mailing list