[Vegan-commits] r2451 - in pkg/vegan: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Feb 22 10:22:06 CET 2013


Author: jarioksa
Date: 2013-02-22 10:22:05 +0100 (Fri, 22 Feb 2013)
New Revision: 2451

Modified:
   pkg/vegan/DESCRIPTION
   pkg/vegan/R/specaccum.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/specaccum.Rd
Log:
resurrect weights for specaccum that were removed in r1606 on Thu, 26 May 2011

Modified: pkg/vegan/DESCRIPTION
===================================================================
--- pkg/vegan/DESCRIPTION	2013-02-20 16:34:18 UTC (rev 2450)
+++ pkg/vegan/DESCRIPTION	2013-02-22 09:22:05 UTC (rev 2451)
@@ -1,7 +1,7 @@
 Package: vegan
 Title: Community Ecology Package
-Version: 2.1-26
-Date: February 11, 2013
+Version: 2.1-27
+Date: February 22, 2013
 Author: Jari Oksanen, F. Guillaume Blanchet, Roeland Kindt, Pierre Legendre, 
    Peter R. Minchin, R. B. O'Hara, Gavin L. Simpson, Peter Solymos, 
    M. Henry H. Stevens, Helene Wagner  

Modified: pkg/vegan/R/specaccum.R
===================================================================
--- pkg/vegan/R/specaccum.R	2013-02-20 16:34:18 UTC (rev 2450)
+++ pkg/vegan/R/specaccum.R	2013-02-22 09:22:05 UTC (rev 2451)
@@ -1,7 +1,9 @@
 `specaccum` <-
     function (comm, method = "exact", permutations = 100, conditioned=TRUE,
-              gamma="jack1", ...)
+              gamma="jack1", w = NULL, ...)
 {
+    if (!is.null(w) && !(method %in% c("random", "collector")))
+        stop(gettextf("weights 'w' can be only used with methods 'random' and 'collector'"))
     x <- comm
     x <- as.matrix(x)
     x <- x[, colSums(x) > 0, drop=FALSE]
@@ -22,11 +24,16 @@
         message("No actual accumulation since only 1 site provided")
     switch(method, collector = {
         sites <- 1:n
+        weights <- cumsum(w)
         specaccum <- accumulator(x, sites)
     }, random = {
         perm <- array(dim = c(n, permutations))
+        if (!is.null(w))
+            weights <- array(dim = c(n, permutations))
         for (i in 1:permutations) {
-            perm[, i] <- accumulator(x, sample(n))
+            perm[, i] <- accumulator(x, ord <- sample(n))
+            if(!is.null(w))
+                weights[,i] <- cumsum(w[ord])
         }
         sites <- 1:n
         specaccum <- apply(perm, 1, mean)
@@ -87,6 +94,8 @@
     })
     out <- list(call = match.call(), method = method, sites = sites,
                 richness = specaccum, sd = sdaccum, perm = perm)
+    if (!is.null(weights))
+        out$weights <- weights
     if (method == "rarefaction")
         out$individuals <- ind
     class(out) <- "specaccum"

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2013-02-20 16:34:18 UTC (rev 2450)
+++ pkg/vegan/inst/ChangeLog	2013-02-22 09:22:05 UTC (rev 2451)
@@ -2,6 +2,17 @@
 
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
+Version 2.1-27 (opened Februray 22, 2013)
+
+	* specaccum: gained argument 'w' for weights to give the sampling
+	effort. This resurrects a feature that was introduced in r1505 (22
+	Feb 2011) and 1507, and removed in r1606 (26 May 2011). It seems
+	that BiodiversityR::balanced.specaccum() provides the same feature
+	but we still try it here.  The feature was resurrected after a
+	user query by Bastien Mérigot (Univ Montpellier II). The working
+	of the new argument is still untested with specaccum() support
+	functions.
+	
 Version 2.1-26 (opened February 11, 2013)
 
 	* New version opened with the release of vegan_2.0-6 on February

Modified: pkg/vegan/man/specaccum.Rd
===================================================================
--- pkg/vegan/man/specaccum.Rd	2013-02-20 16:34:18 UTC (rev 2450)
+++ pkg/vegan/man/specaccum.Rd	2013-02-22 09:22:05 UTC (rev 2451)
@@ -17,7 +17,7 @@
 }
 \usage{
 specaccum(comm, method = "exact", permutations = 100,
-          conditioned =TRUE, gamma = "jack1",  ...)
+          conditioned =TRUE, gamma = "jack1",  w = NULL, ...)
 \method{plot}{specaccum}(x, add = FALSE, ci = 2, ci.type = c("bar", "line", "polygon"), 
     col = par("fg"), ci.col = col, ci.lty = 1, xlab, 
     ylab = x$method, ylim, xvar = c("sites", "individuals"), ...)
@@ -43,7 +43,9 @@
   \item{conditioned}{ Estimation of standard deviation is conditional on
     the empirical dataset for the exact SAC}
   \item{gamma}{Method for estimating the total extrapolated number of species in the
-    survey area by function \code{\link{specpool}}} 
+    survey area by function \code{\link{specpool}}}
+  \item{w}{Weights giving the sampling effort (an experimental feature
+    that may be removed).}
   \item{x}{A \code{specaccum} result object}
   \item{add}{Add to an existing graph.}
   \item{ci}{Multiplier used to get confidence intervals from standard



More information about the Vegan-commits mailing list