[Vegan-commits] r2853 - in pkg/vegan: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Feb 8 08:31:55 CET 2014


Author: jarioksa
Date: 2014-02-08 08:31:55 +0100 (Sat, 08 Feb 2014)
New Revision: 2853

Modified:
   pkg/vegan/R/as.hclust.spantree.R
   pkg/vegan/man/reorder.hclust.Rd
Log:
add option for unweighted means in reorder.hclust

Modified: pkg/vegan/R/as.hclust.spantree.R
===================================================================
--- pkg/vegan/R/as.hclust.spantree.R	2014-02-07 09:33:46 UTC (rev 2852)
+++ pkg/vegan/R/as.hclust.spantree.R	2014-02-08 07:31:55 UTC (rev 2853)
@@ -75,7 +75,9 @@
 ### mean of its leaves.
 
 `reorder.hclust` <-
-    function(x, wts, agglo.FUN = c("mean", "min", "max", "sum"), ...)
+    function(x, wts,
+             agglo.FUN = c("mean", "min", "max", "sum", "uwmean"),
+             ...)
 {
     agglo.FUN <- match.arg(agglo.FUN)
     merge <- x$merge
@@ -103,7 +105,8 @@
                    "mean" = weighted.mean(pair, pairw),
                    "min" = min(pair),
                    "max" = max(pair),
-                   "sum" = sum(pair))
+                   "sum" = sum(pair),
+                   "uwmean" = mean(pair))
         counts[i] <- sum(pairw)
     }
     ## Get the 'order' of the reordered dendrogram

Modified: pkg/vegan/man/reorder.hclust.Rd
===================================================================
--- pkg/vegan/man/reorder.hclust.Rd	2014-02-07 09:33:46 UTC (rev 2852)
+++ pkg/vegan/man/reorder.hclust.Rd	2014-02-08 07:31:55 UTC (rev 2853)
@@ -18,7 +18,8 @@
 }
 
 \usage{
-\method{reorder}{hclust}(x, wts, agglo.FUN = c("mean", "min", "max", "sum"), ...)
+\method{reorder}{hclust}(x, wts, 
+   agglo.FUN = c("mean", "min", "max", "sum", "uwmean"), ...)
 \method{rev}{hclust}(x)
 }
 
@@ -46,13 +47,15 @@
   differently when the \code{agglo.FUN} is \code{"mean"}: the
   \code{\link{reorder.dendrogram}} will always take the direct mean of
   member groups ignoring their sizes, but this function will used
-  \code{\link{weighted.mean}} weighted by group sizes, so that the group
-  mean is always the mean of member leaves (terminal nodes).
+  \code{\link{weighted.mean}} weighted by group sizes, so that the
+  group mean is always the mean of member leaves (terminal nodes). If
+  you want to ignore group sizes, you can use unweighted mean with
+  \code{"uwmean"}. 
 
   The function accepts only a limited list of \code{agglo.FUN}
   functions for assessing the value of \code{wts} for groups. The
-  ordering is always ascending, but the order of leaves can be reversed
-  with \code{rev}.
+  ordering is always ascending, but the order of leaves can be
+  reversed with \code{rev}. 
 
 }
 



More information about the Vegan-commits mailing list