[Phylobase-commits] r461 - branches/fm-branch/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Aug 14 03:31:23 CEST 2009


Author: francois
Date: 2009-08-14 03:31:21 +0200 (Fri, 14 Aug 2009)
New Revision: 461

Modified:
   branches/fm-branch/R/class-phylo4d.R
   branches/fm-branch/R/methods-phylo4d.R
Log:
fix bug with passing node labels as data

Modified: branches/fm-branch/R/class-phylo4d.R
===================================================================
--- branches/fm-branch/R/class-phylo4d.R	2009-08-13 20:26:25 UTC (rev 460)
+++ branches/fm-branch/R/class-phylo4d.R	2009-08-14 01:31:21 UTC (rev 461)
@@ -197,21 +197,22 @@
         # FIXME? use.node.names=TRUE won't work with this option b/c
         # node labels are dropped; assumes node.data (if any), phylo
         # node.label, and phylo4 internal nodes are in the same order?
+
         nlab.data <- x$node.label
         x$node.label <- NULL
         nlab.data[!nzchar(nlab.data)] <- NA
 
         nlab.data <- data.frame(labelValues=as.numeric(nlab.data))
-        if (is.null(node.data)) {
-            node.data <- nlab.data
-        } else {
-            node.data <- cbind(nlab.data, node.data)
-        }
+
         tree <- phylo4(x, check.node.labels="drop")
-    } else {
+        res <- phylo4d(tree, tip.data, node.data, all.data, ...)
+        res <- addData(res, node.data=nlab.data, pos="before", match.data=FALSE)
+    }
+    else {
         tree <- phylo4(x, check.node.labels=check.node.labels)
+        res <- phylo4d(tree, tip.data, node.data, all.data, ...)
     }
-    res <- phylo4d(tree, tip.data, node.data, all.data, ...)
+
     return(res)
 })
 

Modified: branches/fm-branch/R/methods-phylo4d.R
===================================================================
--- branches/fm-branch/R/methods-phylo4d.R	2009-08-13 20:26:25 UTC (rev 460)
+++ branches/fm-branch/R/methods-phylo4d.R	2009-08-14 01:31:21 UTC (rev 461)
@@ -138,7 +138,7 @@
 
 setMethod("addData", "phylo4d", function(x, tip.data=NULL, node.data=NULL,
                                          all.data=NULL, pos=c("after", "before"),
-                                         merge.data=TRUE, match.data=TRUE,
+                                         merge.data=TRUE, match.data,
                                          ...) {
     pos <- match.arg(pos)
 



More information about the Phylobase-commits mailing list