[Phylobase-commits] r692 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Oct 14 22:20:27 CEST 2009


Author: regetz
Date: 2009-10-14 22:20:26 +0200 (Wed, 14 Oct 2009)
New Revision: 692

Modified:
   pkg/R/treewalk.R
Log:
changed getEdge to allow missing node argument, in which case all edges
appropriate for the given type are returned


Modified: pkg/R/treewalk.R
===================================================================
--- pkg/R/treewalk.R	2009-10-14 16:33:55 UTC (rev 691)
+++ pkg/R/treewalk.R	2009-10-14 20:20:26 UTC (rev 692)
@@ -234,11 +234,18 @@
 
     if(!identical(class(phy), "phylo4")) phy <- as(phy, "phylo4")
 
+    type <- match.arg(type)
     missing <- match.arg(missing)
+    if (missing(node)) {
+        if (type=="descendant") {
+            node <- nodeId(phy, "all")
+        } else if (type=="ancestor") {
+            node <- nodeId(phy, "internal")
+        }
+    }
+
     node.id <- getNode(phy, node, missing="OK")
 
-    type <- match.arg(type)
-
     nd <- lapply(node.id, function(x) {
         if (is.na(x)) {
             res <- NA



More information about the Phylobase-commits mailing list