[Ecopd-commits] r50 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 26 18:38:52 CET 2009


Author: regetz
Date: 2009-10-26 18:38:52 +0100 (Mon, 26 Oct 2009)
New Revision: 50

Modified:
   pkg/R/pd.R
Log:
cleaned up weightByAbund function


Modified: pkg/R/pd.R
===================================================================
--- pkg/R/pd.R	2009-10-26 17:16:06 UTC (rev 49)
+++ pkg/R/pd.R	2009-10-26 17:38:52 UTC (rev 50)
@@ -83,12 +83,7 @@
 
   n <- abundance(tree)
   minLength <- minTL(tree)
-
-  tipLen <- ancestralEdgeLength(foo, getnodes(foo,
-    names(abundance(foo))))
-  # Longer form above ensures consistent ordering, but given phylo4
-  # rules it might be sufficient to use:
-  # tipLen <- ancestralEdgeLength(foo, nodes(foo, "tip"))
+  tipLen <- tipLength(tree)
  
   # Test statement:
   if (!identical(names(n), names(minLength))) {
@@ -106,8 +101,7 @@
   # Note that this is (unfortunately) tightly coupled to the
   # implementation of phylo4 objects -- an assignment method would be
   # better
-  tree at edge.length[match(nodes(tree, "tip"), edges(tree)[,2])] <-
-    newLength
+  tree at edge.length[getEdge(tree, nodeId(tree, "tip"))] <- newLength
 
   return(tree)
 



More information about the Ecopd-commits mailing list