[Phylobase-commits] r477 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 18 20:59:02 CEST 2009


Author: bbolker
Date: 2009-08-18 20:59:01 +0200 (Tue, 18 Aug 2009)
New Revision: 477

Modified:
   pkg/R/checkdata.R
   pkg/R/methods-phylo4.R
Log:
  changed labels() to return vector of NAs rather than character(0)
for empty node labels: tweaked formatData to compensate
 


Modified: pkg/R/checkdata.R
===================================================================
--- pkg/R/checkdata.R	2009-08-18 18:33:08 UTC (rev 476)
+++ pkg/R/checkdata.R	2009-08-18 18:59:01 UTC (rev 477)
@@ -184,7 +184,8 @@
         if(type != "all") {
             switch(type,
                    tip = {
-                       if(any(names(ndDt) %in% labels(phy, "internal")))
+                     ## BMB: don't bother trying to match NAs
+                       if(any(na.omit(names(ndDt)) %in% labels(phy, "internal")))
                            stop("You are trying to match tip data to internal ",
                                 "nodes. Make sure that your data identifiers ",
                                 "are correct.")

Modified: pkg/R/methods-phylo4.R
===================================================================
--- pkg/R/methods-phylo4.R	2009-08-18 18:33:08 UTC (rev 476)
+++ pkg/R/methods-phylo4.R	2009-08-18 18:59:01 UTC (rev 477)
@@ -209,21 +209,17 @@
     "internal", "allnode"), ...) {
     type <- match.arg(type)
     switch(type,
-            tip = object at tip.label[as.character(nodeId(object, "tip"))],
-            internal = {
-                if (hasNodeLabels(object)) {
-                    object at node.label
-                }
-                else
-                {
-                    ## FIXME? should this return object at node.label
-                    return(character(0))
-                }
-            },
-            allnode = {
-                c(object at tip.label, object at node.label)
-              }
-            )
+           tip = object at tip.label[as.character(nodeId(object, "tip"))],
+           internal =  object at node.label,
+##                 if (hasNodeLabels(object)) {
+##                     object at node.label
+##                 }
+##                 else
+##                 {
+##                     ## FIXME? should this return object at node.label
+##                     return(character(0))
+           allnode = c(object at tip.label, object at node.label)
+           )
 })
 
 setReplaceMethod("labels",



More information about the Phylobase-commits mailing list