[Phylobase-commits] r307 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Dec 18 05:09:28 CET 2008


Author: bbolker
Date: 2008-12-18 05:09:28 +0100 (Thu, 18 Dec 2008)
New Revision: 307

Modified:
   pkg/R/treewalk.R
Log:
tweaked error handling



Modified: pkg/R/treewalk.R
===================================================================
--- pkg/R/treewalk.R	2008-12-09 05:18:07 UTC (rev 306)
+++ pkg/R/treewalk.R	2008-12-18 04:09:28 UTC (rev 307)
@@ -113,6 +113,11 @@
 
     ## Correct behavior when the root is part of the nodes
     testNodes <- lapply(nodes, getnodes, phy=phy)
+    ## BMB: why lapply, not sapply?
+    lNodes <- unlist(testNodes)
+    if (any(is.na(lNodes)))
+      stop("nodes not found in tree: ",paste(names(lNodes)[is.na(lNodes)],
+                                             collapse=", "))
     uniqueNodes <- unique(testNodes)
     root <- nTips(phy)+1
     if(root %in% uniqueNodes) {



More information about the Phylobase-commits mailing list