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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Nov 10 16:42:29 CET 2013


Author: jarioksa
Date: 2013-11-10 16:42:28 +0100 (Sun, 10 Nov 2013)
New Revision: 2696

Modified:
   pkg/vegan/R/anova.ccalist.R
   pkg/vegan/R/anovacca.R
   pkg/vegan/man/anovacca.Rd
Log:
anovacca gained support for anova.ccalist

Modified: pkg/vegan/R/anova.ccalist.R
===================================================================
--- pkg/vegan/R/anova.ccalist.R	2013-11-10 15:08:25 UTC (rev 2695)
+++ pkg/vegan/R/anova.ccalist.R	2013-11-10 15:42:28 UTC (rev 2696)
@@ -1,16 +1,7 @@
 `anova.ccalist` <-
     function(object, ..., permutations = 99)
 {
-    ## Collect cca class objects. FIXME: Eventually this should be in
-    ## a function that calls permutest.ccalist after collecting model
-    ## objects from dotargs.
-    dotargs <- list(...)
-    if (length(dotargs)) {
-        isCCA <- sapply(dotargs, function(z) inherits(z, "cca"))
-        dotargs <- dotargs[isCCA]
-        if (length(dotargs))
-            object <- c(list(object), dotargs)
-    }
+    ## 'object' *must* be a list of cca objects
     nmodels <- length(object)
     ## check that input is valid
     ## 1. All models must be fitted with the same method

Modified: pkg/vegan/R/anovacca.R
===================================================================
--- pkg/vegan/R/anovacca.R	2013-11-10 15:08:25 UTC (rev 2695)
+++ pkg/vegan/R/anovacca.R	2013-11-10 15:42:28 UTC (rev 2696)
@@ -5,10 +5,7 @@
     if (is.null(object$CA) || is.null(object$CCA) ||
         object$CCA$rank == 0 || object$CA$rank == 0)
         return(anova.ccanull(object))
-    if (!is.null(by)) {
-        by <- match.arg(by, c("axis", "terms", "margin"))
-        .NotYetUsed("by")
-    }
+
     if (!exists(".Random.seed", envir = .GlobalEnv,
                 inherits = FALSE)) 
         runif(1)
@@ -35,6 +32,24 @@
         seed <- NA
     nperm <- nrow(permutations)
     ## stop permutations block
+    ## see if this was a list of ordination objects
+    dotargs <- list(...)
+    if (length(dotargs)) {
+        isCCA <- sapply(dotargs, function(z) inherits(z, "cca"))
+        dotargs <- dotargs[isCCA]
+        if (length(dotargs)) {
+            object <- c(list(object), dotargs)
+            sol <- anova.ccalist(object, ...,
+                                 permutations = permutations)
+            return(sol)
+        }
+    }
+    ## by cases
+    if (!is.null(by)) {
+        by <- match.arg(by, c("axis", "terms", "margin"))
+        .NotYetUsed("by")
+    }
+    ## basic overall test
     tst <- permutest.cca(object, permutations = permutations, ...)
     Fval <- c(tst$F.0, NA)
     Pval <- (sum(tst$F.perm >= tst$F.0) + 1)/(tst$nperm + 1)

Modified: pkg/vegan/man/anovacca.Rd
===================================================================
--- pkg/vegan/man/anovacca.Rd	2013-11-10 15:08:25 UTC (rev 2695)
+++ pkg/vegan/man/anovacca.Rd	2013-11-10 15:42:28 UTC (rev 2696)
@@ -28,8 +28,11 @@
 
 \arguments{
 
-  \item{object}{A result object from \code{\link{cca}},
-    \code{\link{rda}} or \code{\link{capscale}}. }
+  \item{object}{One or several result objects from \code{\link{cca}},
+    \code{\link{rda}} or \code{\link{capscale}}. If there are several
+    result objects, they are compared against each other in the ordre
+    they were supplied. For a single object, a test specified in
+    \code{by} or an overal test is given. }
  
   \item{permutations}{Either a \code{\link[permute]{how}} result
     defining permutations, or a permutation matrix with each row giving



More information about the Vegan-commits mailing list