[Ecopd-commits] r49 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 26 18:16:06 CET 2009


Author: regetz
Date: 2009-10-26 18:16:06 +0100 (Mon, 26 Oct 2009)
New Revision: 49

Modified:
   pkg/R/utilities.R
Log:
updated minTL getter/setter functions to reflect phylobase changes


Modified: pkg/R/utilities.R
===================================================================
--- pkg/R/utilities.R	2009-10-24 00:06:20 UTC (rev 48)
+++ pkg/R/utilities.R	2009-10-26 17:16:06 UTC (rev 49)
@@ -116,22 +116,22 @@
 
 # minTL extractor
 minTL <- function(phy) {
-  minTL <- tdata(phy)$minTL
+  minTL <- tipData(phy)$minTL
   if (!is.null(minTL)) {
-    names(minTL) <- row.names(tdata(phy))
+    names(minTL) <- row.names(tipData(phy))
   }
   return(minTL)
 }
 
+# Note: function assumes values are in nodeId(phy, "tip") order
 # minTL assignment function
 `minTL<-` <- function(phy, value) {
-# MAKE SURE THIS MATCHES WITH THE TAXA ORDER IN THE TREE!
   if (!is.numeric(value)) {
     stop("minTL values must be a numeric vector")
-  } else if (length(value)!=nrow(tdata(phy))) {
+  } else if (length(value)!=nTips(phy)) {
     stop("number of minTL values must equal number of species")
   }
-  phy at tip.data <- replace(phy at tip.data, "minTL", value)
+  tipData(phy)[["minTL"]] <- value
   return(phy)
 }
 



More information about the Ecopd-commits mailing list