[Phylobase-commits] r564 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Aug 22 00:08:03 CEST 2009


Author: francois
Date: 2009-08-22 00:08:02 +0200 (Sat, 22 Aug 2009)
New Revision: 564

Modified:
   pkg/R/checkdata.R
   pkg/R/methods-phylo4d.R
Log:
fixed bug in matching data and tree in the case of single column data

Modified: pkg/R/checkdata.R
===================================================================
--- pkg/R/checkdata.R	2009-08-21 21:51:30 UTC (rev 563)
+++ pkg/R/checkdata.R	2009-08-21 22:08:02 UTC (rev 564)
@@ -292,7 +292,7 @@
         dt <- dt[!is.na(ndDt) ,, drop=FALSE]
         rownames(dt) <- ndDt[!is.na(ndDt)]
         if(label.type == "column") dt <- dt[, -label.column]
-        tmpDt[match(rownames(dt), rownames(tmpDt)), ] <- dt
+        tmpDt <- dt[match(rownames(tmpDt), rownames(dt)) ,, drop=FALSE]
     }
     else {
         ## Remove rownames in data provided

Modified: pkg/R/methods-phylo4d.R
===================================================================
--- pkg/R/methods-phylo4d.R	2009-08-21 21:51:30 UTC (rev 563)
+++ pkg/R/methods-phylo4d.R	2009-08-21 22:08:02 UTC (rev 564)
@@ -15,7 +15,7 @@
               return(x at tip.data)
           }
           tdata <- x at tip.data
-          data.names <- tipLabels(x)
+          data.names <- tipLabels(x)[match(names(tipLabels(x)), rownames(tdata))]
           if ( label.type ==  "row.names" ) {
               if (!any(duplicated(data.names)) &&
                   !any(is.na(data.names)) ) {
@@ -39,7 +39,7 @@
           }
           tdata <- x at node.data
           if(hasNodeLabels(x))
-              data.names <- nodeLabels(x)
+              data.names <- nodeLabels(x)[match(names(nodeLabels(x)), rownames(tdata))]
           else
               data.names <- nodeId(x, "internal")
 
@@ -65,7 +65,7 @@
           ## node data
           if (all(dim(x at node.data) == 0)) { # empty data
               if (!hasNodeLabels(x)) {
-                  nodedata <- data.frame(label=x at node.label)
+                  nodedata <- data.frame(label=nodeId(x, "internal"))
               }
               else
                   nodedata <- data.frame(label=nodeLabels(x))



More information about the Phylobase-commits mailing list