[Ecopd-commits] r59 - branches/single-tree/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Nov 9 19:07:13 CET 2009


Author: regetz
Date: 2009-11-09 19:07:12 +0100 (Mon, 09 Nov 2009)
New Revision: 59

Modified:
   branches/single-tree/R/utilities.R
Log:
added simple function to return presence/absence matrix


Modified: branches/single-tree/R/utilities.R
===================================================================
--- branches/single-tree/R/utilities.R	2009-11-09 18:06:02 UTC (rev 58)
+++ branches/single-tree/R/utilities.R	2009-11-09 18:07:12 UTC (rev 59)
@@ -70,6 +70,14 @@
   return(phy)
 }
 
+presence <- function(phy) {
+    N <- abundance(phy)
+    N[N > 0] <- 1
+    N[N <= 0] <- 0
+    N[is.na(N)] <- 0
+    N
+}
+
 # minTL extractor
 minTL <- function(phy) {
   minTL <- tipData(phy)$minTL



More information about the Ecopd-commits mailing list