[Phylobase-commits] r294 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Nov 21 11:28:41 CET 2008


Author: jombart
Date: 2008-11-21 11:28:41 +0100 (Fri, 21 Nov 2008)
New Revision: 294

Modified:
   pkg/R/treewalk.R
Log:
Bug fix in ancestors (was not working when root was given as node).


Modified: pkg/R/treewalk.R
===================================================================
--- pkg/R/treewalk.R	2008-11-21 10:09:39 UTC (rev 293)
+++ pkg/R/treewalk.R	2008-11-21 10:28:41 UTC (rev 294)
@@ -89,6 +89,10 @@
     if (is.na(node)) stop("node ",node," not found in tree")
     res <- numeric(0)
     n <- nTips(phy)
+
+    ## correct behavior when node==root
+    if(node == rootNode(phy)) return(NULL)
+
     repeat {
         anc <- ancestor(phy,node)
         res <- c(res,anc)



More information about the Phylobase-commits mailing list