[Picante-commits] r68 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 22 00:24:51 CEST 2008


Author: skembel
Date: 2008-05-22 00:24:50 +0200 (Thu, 22 May 2008)
New Revision: 68

Added:
   pkg/R/pruning.R
Log:
WTF happened to pruning.R?

Added: pkg/R/pruning.R
===================================================================
--- pkg/R/pruning.R	                        (rev 0)
+++ pkg/R/pruning.R	2008-05-21 22:24:50 UTC (rev 68)
@@ -0,0 +1,21 @@
+`prune.sample` <-
+function (samp, phylo) 
+{
+    treeTaxa <- phylo$tip.label
+    sampleTaxa <- colnames(samp)
+    trimTaxa <- setdiff(treeTaxa, sampleTaxa)
+    if (length(trimTaxa) > 0) drop.tip(phylo, trimTaxa) else phylo
+}
+
+'prune.missing' <-
+function(x, phylo) {
+	result <- list(NULL)
+    treeTaxa <- phylo$tip.label
+    traitTaxa <- names(na.omit(x[phylo$tip.label]))
+    trimTaxa <- setdiff(treeTaxa, traitTaxa)
+    if (length(trimTaxa) > 0) 
+        result$tree <- drop.tip(phylo, trimTaxa)
+    else result$tree <- phylo
+	result$data <- na.omit(x[phylo$tip.label])
+    result
+}



More information about the Picante-commits mailing list