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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Dec 7 20:01:17 CET 2008


Author: psolymos
Date: 2008-12-07 20:01:17 +0100 (Sun, 07 Dec 2008)
New Revision: 619

Modified:
   pkg/vegan/R/adipart.R
   pkg/vegan/man/adipart.Rd
Log:
big permat update


Modified: pkg/vegan/R/adipart.R
===================================================================
--- pkg/vegan/R/adipart.R	2008-12-07 16:55:38 UTC (rev 618)
+++ pkg/vegan/R/adipart.R	2008-12-07 19:01:17 UTC (rev 619)
@@ -1,6 +1,6 @@
 adipart <-
 function(matr, strata, index=c("richness", "shannon", "simpson"),
-    weights=c("unif", "prop"), nsimul=99, control, ...)
+    weights=c("unif", "prop"), relative = FALSE, nsimul=99, control, ...)
 {
 
     ## internal function, maybe later gets out
@@ -52,6 +52,8 @@
             wt <- lapply(1:nl, function(i) apply(tmp[[i]], 1, function(z) sum(z) / sum(matr)))
             else wt <- lapply(1:nl, function(i) rep(1 / NROW(tmp[[i]]), NROW(tmp[[i]])))
         a <- sapply(1:nl, function(i) sum(divfun(tmp[[i]]) * wt[[i]]))
+        if (relative)
+            a <- a / a[length(a)]
         b <- sapply(2:nl, function(i) a[i] - a[(i-1)])
         c(a, b)
     }

Modified: pkg/vegan/man/adipart.Rd
===================================================================
--- pkg/vegan/man/adipart.Rd	2008-12-07 16:55:38 UTC (rev 618)
+++ pkg/vegan/man/adipart.Rd	2008-12-07 19:01:17 UTC (rev 619)
@@ -8,7 +8,7 @@
 }
 \usage{
 adipart(matr, strata, index=c("richness", "shannon", "simpson"),
-weights=c("unif", "prop"), nsimul=99, control, ...)
+weights=c("unif", "prop"), relative = FALSE, nsimul=99, control, ...)
 \method{print}{adipart}(x, ...)
 }
 \arguments{
@@ -16,6 +16,7 @@
   \item{strata}{A matrix or data frame containing levels of sampling hierarchy as columns, columns from right to left will be treated as nested (first column is the lowest, last is the highest level).}
   \item{index}{Character, the diversity index to be calculated, one of  \code{c("richness", "shannon", "simpson")}.}
   \item{weights}{Character, \code{"unif"} for uniform weights, \code{"prop"} for weighting proportional to sample abundances to use in weighted averaging of individual alpha values within strata of a given level of the sampling hierarchy.}
+  \item{relative}{Logical, if \code{TRUE} then alpha and beta diversity values are given relative to the value of gamma. This can be useful when comparing different indices.}
   \item{nsimul}{Number of permutation to use if \code{matr} is not of class 'permat'.}
   \item{control}{A list of arguments passed to quantitative permutation
           algorithms. If missing, the function  'permat.control' is used.}



More information about the Vegan-commits mailing list