[Vegan-commits] r2910 - in pkg/vegan: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Nov 10 11:41:55 CET 2014


Author: jarioksa
Date: 2014-11-10 11:41:55 +0100 (Mon, 10 Nov 2014)
New Revision: 2910

Modified:
   pkg/vegan/DESCRIPTION
   pkg/vegan/R/anova.cca.R
   pkg/vegan/R/getPermuteMatrix.R
Log:
Squashed commit of the following:

commit 65e815f0f4e49ce728e88f128af5e00bc68e97f4
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Mon Nov 10 12:26:54 2014 +0200

    Update DESCRIPTION date

    Cherry-picked fixes to 'strata' handling in anova.cca from
    master/fix-strata-redefinition

commit 4436bcb8dbb530e38cb0a541926d0606b55109e4
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Mon Nov 10 11:06:09 2014 +0200

    anova.cca passes permutationMatrix: no need to pass 'strata'

    anova.cca alwyas passes a permutation matrix to permutest.cca
    and there is no need to pass 'strata' (which will be ingored).

commit 3e14e65e8d70332b35818f3c4ac7f1c4849d4289
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Sun Nov 9 20:23:28 2014 +0200

    Do not set strata if they appear to have been set earlier

    anova.cca generated permutation matrix with strata in
    getPermuteMatrix and passed that on to other functions (like
    permutest.cca). This was broken in efd575f1 which passed
    strata from anova.cca (unnecessarily), but we fix it in
    getPermuteMatrix so that the solution is more general (and
    strata are to be deprecated in the next releases in any case).

Modified: pkg/vegan/DESCRIPTION
===================================================================
--- pkg/vegan/DESCRIPTION	2014-11-07 14:12:27 UTC (rev 2909)
+++ pkg/vegan/DESCRIPTION	2014-11-10 10:41:55 UTC (rev 2910)
@@ -1,7 +1,7 @@
 Package: vegan
 Title: Community Ecology Package
 Version: 2.2-0
-Date: 2014-11-07
+Date: 2014-11-10
 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/anova.cca.R
===================================================================
--- pkg/vegan/R/anova.cca.R	2014-11-07 14:12:27 UTC (rev 2909)
+++ pkg/vegan/R/anova.cca.R	2014-11-10 10:41:55 UTC (rev 2910)
@@ -53,10 +53,10 @@
         attr(sol, "control") <- control
         return(sol)
     }
-    ## basic overall test
+    ## basic overall test: pass other arguments except 'strata'
+    ## because 'permutations' already is a permutationMatrix
     tst <- permutest.cca(object, permutations = permutations,
-                         model = model, parallel = parallel,
-                         strata = strata, ...)
+                         model = model, parallel = parallel, ...)
     Fval <- c(tst$F.0, NA)
     Pval <- (sum(tst$F.perm >= tst$F.0) + 1)/(tst$nperm + 1)
     Pval <- c(Pval, NA)

Modified: pkg/vegan/R/getPermuteMatrix.R
===================================================================
--- pkg/vegan/R/getPermuteMatrix.R	2014-11-07 14:12:27 UTC (rev 2909)
+++ pkg/vegan/R/getPermuteMatrix.R	2014-11-10 10:41:55 UTC (rev 2910)
@@ -14,13 +14,10 @@
     if (length(perm) == 1) {
         perm <- how(nperm = perm) 
     }
-    ## apply 'strata'
+    ## apply 'strata', but only if possible: ignore silently other cases
     if (!missing(strata) && !is.null(strata)) {
-        if (!inherits(perm, "how"))  # 'perm' is a matrix
-            stop("'strata' can be used only with simple permutation or with 'how()'")
-        if (!is.null(getBlocks(perm)))
-            stop("'strata' cannot be applied when 'blocks' are defined in 'how()'")
-        setBlocks(perm) <- strata
+        if (inherits(perm, "how") && is.null(getBlocks(perm)))
+            setBlocks(perm) <- strata
     }
     ## now 'perm' is either a how() or a matrix
     if (inherits(perm, "how"))



More information about the Vegan-commits mailing list