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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Dec 1 17:44:31 CET 2013


Author: jarioksa
Date: 2013-12-01 17:44:30 +0100 (Sun, 01 Dec 2013)
New Revision: 2790

Modified:
   pkg/vegan/R/anovacca.R
   pkg/vegan/R/anovacca.byterm.R
   pkg/vegan/man/anovacca.Rd
Log:
anovacca(..., by='margin' gained 'scope'

Modified: pkg/vegan/R/anovacca.R
===================================================================
--- pkg/vegan/R/anovacca.R	2013-12-01 16:34:07 UTC (rev 2789)
+++ pkg/vegan/R/anovacca.R	2013-12-01 16:44:30 UTC (rev 2790)
@@ -2,7 +2,7 @@
     function(object, ..., permutations = how(nperm=999), by = NULL,
              model = c("reduced", "direct", "full"),
              parallel = getOption("mc.cores"), strata = NULL,
-             cutoff = 1) 
+             cutoff = 1, scope = NULL) 
 {
     model <- match.arg(model)
     ## permutations is either a single number, a how() structure or a
@@ -62,7 +62,8 @@
                       model = model, parallel = parallel),
                       "margin" = anovacca.bymargin(object,
                       permutations = permutations,
-                      model = model, parallel = parallel),
+                      model = model, parallel = parallel,
+                      scope = scope),
                       "axis" = anovacca.byaxis(object,
                       permutations = permutations,
                       model = model, parallel = parallel,

Modified: pkg/vegan/R/anovacca.byterm.R
===================================================================
--- pkg/vegan/R/anovacca.byterm.R	2013-12-01 16:34:07 UTC (rev 2789)
+++ pkg/vegan/R/anovacca.byterm.R	2013-12-01 16:44:30 UTC (rev 2790)
@@ -46,14 +46,17 @@
 ## term in turn and compare against the complete model.
 
 `anovacca.bymargin` <-
-    function(object, permutations, ...)
+    function(object, permutations, scope, ...)
 {
     nperm <- nrow(permutations)
     ## Refuse to handle models with missing data
     if (!is.null(object$na.action))
         stop("by = 'margin' models cannot handle missing data")
     ## We need term labels but without Condition() terms
-    trms <- drop.scope(object)
+    if (!is.null(scope) && is.character(scope))
+        trms <- scope
+    else
+        trms <- drop.scope(object)
     trmlab <- trms[trms %in% attr(terms(object$terminfo),
                                       "term.labels")]
     ## baseline: all terms

Modified: pkg/vegan/man/anovacca.Rd
===================================================================
--- pkg/vegan/man/anovacca.Rd	2013-12-01 16:34:07 UTC (rev 2789)
+++ pkg/vegan/man/anovacca.Rd	2013-12-01 16:44:30 UTC (rev 2790)
@@ -25,7 +25,7 @@
 anovacca(object, ..., permutations = how(nperm=999),
       by = NULL, model = c("reduced", "direct", "full"), 
       parallel = getOption("mc.cores"), strata = NULL,
-      cutoff = 1)
+      cutoff = 1, scope = NULL)
 }
 
 \arguments{
@@ -63,6 +63,10 @@
   \item{cutoff}{Only effective with \code{by="axis"} where stops
     permutations after an axis exceeds the \code{cutoff}.}
 
+  \item{scope}{Only effective with \code{by="margin"} where it can be
+    used to select the marginal terms for testing. The default is to
+    test all marginal terms in \code{\link{drop.scope}}.}
+
   \item{\dots}{Parameters passed to other functions.  \code{anova.cca}
     passes all arguments to \code{permutest.cca}. In \code{anova} with
     \code{by = "axis"} you can use argument \code{cutoff} (defaults



More information about the Vegan-commits mailing list