[Phylobase-commits] r661 - branches/edgesNAto0/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 23 07:07:43 CEST 2009


Author: pdc
Date: 2009-09-23 07:07:43 +0200 (Wed, 23 Sep 2009)
New Revision: 661

Modified:
   branches/edgesNAto0/R/treewalk.R
Log:
getNode should return a named vector of integers 
removed debugging code

Modified: branches/edgesNAto0/R/treewalk.R
===================================================================
--- branches/edgesNAto0/R/treewalk.R	2009-09-23 04:59:02 UTC (rev 660)
+++ branches/edgesNAto0/R/treewalk.R	2009-09-23 05:07:43 UTC (rev 661)
@@ -9,7 +9,6 @@
 
 getNode <- function(phy, node, missing=c("warn","OK","fail")) {
     missing <- match.arg(missing)
-    browser()
     if (is.numeric(node) && all(floor(node) == node, na.rm=TRUE)) {
         node <- as.integer(node)
     }
@@ -27,16 +26,16 @@
 
     ## node numbers
     rval <- names(labels(phy, "all"))[irval]
-    rval <- as.integer(rval)
-    browser()
-    rval[node == 0]   <- "0" # root ancestor gets special treatment
+
+    rval[node == 0]   <- 0 # root ancestor gets special treatment
     rval[is.na(node)] <- NA # return NA for any NA_character_ inputs
+    rval <- as.integer(rval)
 
     ## node labels
     nmNd <- labels(phy, "all")[irval]
 
     names(rval) <- nmNd
-    names(rval)[rval == "0"] <- "0" # root ancestor gets special treatment
+    names(rval)[rval == 0] <- "0" # root ancestor gets special treatment
 
     ## deal with nodes that don't match
     if (any(is.na(rval))) {



More information about the Phylobase-commits mailing list