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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 16 16:13:14 CEST 2014


Author: jarioksa
Date: 2014-09-16 16:13:14 +0200 (Tue, 16 Sep 2014)
New Revision: 2883

Modified:
   pkg/vegan/R/CCorA.R
   pkg/vegan/R/adonis.R
   pkg/vegan/R/anosim.R
   pkg/vegan/R/factorfit.R
   pkg/vegan/R/mantel.R
   pkg/vegan/R/mantel.partial.R
   pkg/vegan/R/mrpp.R
   pkg/vegan/R/mso.R
   pkg/vegan/R/print.CCorA.R
   pkg/vegan/R/print.anosim.R
   pkg/vegan/R/print.factorfit.R
   pkg/vegan/R/print.mantel.R
   pkg/vegan/R/print.mrpp.R
   pkg/vegan/R/print.mso.R
   pkg/vegan/R/print.permutest.betadisper.R
   pkg/vegan/R/print.protest.R
   pkg/vegan/R/print.vectorfit.R
   pkg/vegan/R/simper.R
   pkg/vegan/R/vectorfit.R
   pkg/vegan/man/CCorA.Rd
   pkg/vegan/man/anosim.Rd
   pkg/vegan/man/envfit.Rd
   pkg/vegan/man/mantel.Rd
   pkg/vegan/man/mrpp.Rd
   pkg/vegan/man/procrustes.Rd
Log:
Squashed commit of the following:

commit 33198cba46810c1265f0ba6061225b038272a24f
Merge: 0f86b2b 12aa1f2
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Tue Sep 16 17:05:15 2014 +0300

    Merge pull request #39 from jarioksa/adapt-print-to-permute-pkg

    Adapt print to permute pkg

commit 12aa1f2555126075ab3fa9fe9ca6a98aa684f73d
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Tue Sep 16 16:06:49 2014 +0300

    permutest.betadisper also uses howHead() to show permutations

commit 9526decb88cc91ef7db565cafc0adca06989512b
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Mon Sep 15 21:37:31 2014 +0300

    Document cases when a function returns a "control" item

    Some functions return "control" *attributes* with some of their
    items: this is not (yet?) documented.

commit 61df5998b0695dee2a5784eee79de083b1eba308
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Mon Sep 15 21:30:02 2014 +0300

    CCorA returns permute  "control" and print uses howHead() to show it

commit 31c401289c14af2790fa733e72ba05cb695f1179
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Mon Sep 15 21:18:34 2014 +0300

    simper adds "control" attribute for permutations and summary prints it

commit ecce8c723d5e1b68e251e8c16d167af27b0b5a3e
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Mon Sep 15 21:08:34 2014 +0300

    Add empty line between results and permutation details

commit a0333a2640742df2493ae0a75b16b0b17a27b393
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Mon Sep 15 19:17:20 2014 +0300

    mso adds "control" attribute to the "vario" item and howHead() shows it

commit 711938bd8836a0cdb6210d8c536a8a831986aece
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Mon Sep 15 18:56:17 2014 +0300

    remove dangling '.' from the output

commit 5ca3ecc14686f89b23902f28c4910d3279c6b968
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Mon Sep 15 18:43:45 2014 +0300

    adonis adds howHead() to the heading of the anova table

    The permutation information is printed similarly as in
    anova.cca.

commit 16dc86254cb8d692511bcc71759f03e1bb2f6ec9
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Sun Sep 14 20:19:00 2014 +0300

    mrpp printing to the new permute API: no more strata

commit 3728b825dda5303788231414c7f3f1e1735c293e
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Sun Sep 14 19:37:58 2014 +0300

    mantel printing to the new permute API: no more strata

commit 03f764df31f5528012cd8e55e9bb77d884741e7e
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Sun Sep 14 09:10:23 2014 +0300

    adapt envfit printing to the new permute API: no more strata

commit 808cb0c1a0ddafcea99e1f04de16ef4e9b25dfad
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Sun Sep 14 08:40:37 2014 +0300

    print of anosim adapted to the new permute API

    No more stores 'strata', but 'control' and uses howHead() to show
    its result.

    It seems that getPermuteMatrix(..., strata=<name>) does not save the
    name of the 'strata', but howHead() just prints "Blocks: strata".

Modified: pkg/vegan/R/CCorA.R
===================================================================
--- pkg/vegan/R/CCorA.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/CCorA.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -177,7 +177,8 @@
                 RDA.adj.Rsq=c(Rsquare.adj.Y.X, Rsquare.adj.X.Y),
                 nperm=nperm, p.Pillai=p.Pillai, p.perm=p.perm, Cy=Cy, Cx=Cx, 
                 corr.Y.Cy=corr.Y.Cy, corr.X.Cx=corr.X.Cx, corr.Y.Cx=corr.Y.Cx, 
-                corr.X.Cy=corr.X.Cy, call = match.call())
+                corr.X.Cy=corr.X.Cy, control = attr(permat, "control"),
+                call = match.call())
     class(out) <- "CCorA"
     out
 }

Modified: pkg/vegan/R/adonis.R
===================================================================
--- pkg/vegan/R/adonis.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/adonis.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -147,7 +147,8 @@
     rownames(tab) <- c(attr(attr(rhs.frame, "terms"), "term.labels")[u.grps],
                        "Residuals", "Total")
     colnames(tab)[ncol(tab)] <- "Pr(>F)"
-    attr(tab, "heading") <- "Terms added sequentially (first to last)\n"
+    attr(tab, "heading") <- c(howHead(attr(p, "control")),
+        "Terms added sequentially (first to last)\n")
     class(tab) <- c("anova", class(tab))
     out <- list(aov.tab = tab, call = match.call(),
                 coefficients = beta.spp, coef.sites = beta.sites,

Modified: pkg/vegan/R/anosim.R
===================================================================
--- pkg/vegan/R/anosim.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/anosim.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -72,11 +72,8 @@
     sol$statistic <- as.numeric(statistic)
     sol$class.vec <- cl.vec
     sol$dis.rank <- x.rank
-    sol$dissimilarity <- attr(x, "method") 
-    if (!missing(strata)) {
-        sol$strata <- deparse(substitute(strata))
-        sol$stratum.values <- strata
-    }
+    sol$dissimilarity <- attr(x, "method")
+    sol$control <- attr(permat, "control")
     class(sol) <- "anosim"
     sol
 }

Modified: pkg/vegan/R/factorfit.R
===================================================================
--- pkg/vegan/R/factorfit.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/factorfit.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -62,10 +62,7 @@
         names(pval) <- names(P)
     out <- list(centroids = sol, r = r, permutations = permutations, 
                 pvals = pval, var.id = var.id)
-    if (!missing(strata)) {
-        out$strata <- deparse(substitute(strata))
-        out$stratum.values <- strata
-    }
+    out$control <- attr(permat, "control")
     class(out) <- "factorfit"
     out
 }

Modified: pkg/vegan/R/mantel.R
===================================================================
--- pkg/vegan/R/mantel.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/mantel.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -61,11 +61,8 @@
         perm <- NULL
     }
     res <- list(call = match.call(), method = variant, statistic = statistic, 
-                signif = signif, perm = perm, permutations = permutations)
-    if (!missing(strata)) {
-        res$strata <- deparse(substitute(strata))
-        res$stratum.values <- strata
-    }
+                signif = signif, perm = perm, permutations = permutations,
+                control = attr(permat, "control"))
     class(res) <- "mantel"
     res
 }

Modified: pkg/vegan/R/mantel.partial.R
===================================================================
--- pkg/vegan/R/mantel.partial.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/mantel.partial.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -69,7 +69,8 @@
         perm <- NULL
     }
     res <- list(call = match.call(), method = variant, statistic = statistic, 
-                signif = signif, perm = perm, permutations = permutations)
+                signif = signif, perm = perm, permutations = permutations,
+                control = attr(permat, "control"))
     if (!missing(strata)) {
         res$strata <- deparse(substitute(strata))
         res$stratum.values <- strata

Modified: pkg/vegan/R/mrpp.R
===================================================================
--- pkg/vegan/R/mrpp.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/mrpp.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -43,7 +43,7 @@
         stop(gettextf("'permutations' have %d columns, but data have %d rows",
                       ncol(permutations), N))
 
-
+    control <- attr(permutations, "control")
     if(nrow(permutations)) {
         perms <- apply(permutations, 1, function(indx) grouping[indx])
         permutations <- ncol(perms)
@@ -76,13 +76,10 @@
         permutations <- 0
     }
     out <- list(call = match.call(), delta = del, E.delta = E.del, CS = CS,
-        n = ncl, classdelta = classdel,
-                Pvalue = p, A = r2, distance = distance, weight.type = weight.type, 
-        boot.deltas = m.ds, permutations = permutations)
-    if (!missing(strata) && !is.null(strata)) {
-        out$strata <- deparse(substitute(strata))
-        out$stratum.values <- strata
-    }
+                n = ncl, classdelta = classdel, Pvalue = p, A = r2,
+                distance = distance, weight.type = weight.type,
+                boot.deltas = m.ds, permutations = permutations,
+                control = control)
     class(out) <- "mrpp"
     out
 }

Modified: pkg/vegan/R/mso.R
===================================================================
--- pkg/vegan/R/mso.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/mso.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -77,6 +77,7 @@
         perm <- sapply(1:nperm, function(take) permfunc(permat[take,]))
         object$vario$CA.signif <-
             (rowSums(sweep(perm, 1, statistic, ">=")) + 1)/(nperm + 1)
+        attr(object$vario, "control") <- attr(permat, "control")
     }
     object$call <- match.call()
     class(object) <- c("mso", class(object))

Modified: pkg/vegan/R/print.CCorA.R
===================================================================
--- pkg/vegan/R/print.CCorA.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/print.CCorA.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -10,11 +10,13 @@
     cat("Pillai's trace: ", format(x$Pillai, ...), "\n")
     cat("\n")
     cat("Significance of Pillai's trace:\n")
+
+    cat("from F-distribution:  ", format.pval(x$p.Pillai), "\n")
     if (x$nperm > 0) {
-        cat("based on", x$nperm, "permutations: ")
+        cat("based on permutations: ")
         cat(x$p.perm,"\n")
+        cat(howHead(x$control), "\n")
     }
-    cat("from F-distribution: ", format.pval(x$p.Pillai), "\n\n")
     out <- rbind("Eigenvalues" = x$EigenValues, "Canonical Correlations" = x$CanCorr)
     colnames(out) <- colnames(x$Cy)
     printCoefmat(out, ...)

Modified: pkg/vegan/R/print.anosim.R
===================================================================
--- pkg/vegan/R/print.anosim.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/print.anosim.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -1,4 +1,4 @@
-"print.anosim" <-
+`print.anosim` <-
     function (x, digits = max(3, getOption("digits") - 3), ...) 
 {
     cat("\nCall:\n")
@@ -10,10 +10,8 @@
     if (nperm) {
         cat("      Significance:", format.pval(x$signif), 
             "\n\n")
-        cat("Based on ", nperm, " permutations")
+        cat(howHead(x$control))
     }
-    if (!is.null(x$strata)) 
-        cat(", stratified within", x$strata)
-    cat("\n\n")
+    cat("\n")
     invisible(x)
 }

Modified: pkg/vegan/R/print.factorfit.R
===================================================================
--- pkg/vegan/R/print.factorfit.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/print.factorfit.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -1,4 +1,4 @@
-"print.factorfit" <-
+`print.factorfit` <-
     function (x, ...) 
 {
     cat("Centroids:\n")
@@ -7,10 +7,7 @@
     out <- cbind(r2 = x$r, "Pr(>r)" = x$pvals)
     if (x$permutations) {
         printCoefmat(out, has.Pvalue = TRUE, ...)
-        cat("P values based on", x$permutations, "permutations")
-        if (!is.null(x$strata)) 
-            cat(", stratified within", x$strata)
-        cat(".\n")
+        cat(howHead(x$control))
     }
     else  printCoefmat(out, na.print = "", ...)
     invisible(x)

Modified: pkg/vegan/R/print.mantel.R
===================================================================
--- pkg/vegan/R/print.mantel.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/print.mantel.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -16,11 +16,9 @@
     out <- quantile(x$perm, c(0.9, 0.95, 0.975, 0.99))
     cat("Upper quantiles of permutations (null model):\n")
     print(out, digits = 3)
-    cat("\nBased on", nperm, "permutations")
-    if (!is.null(x$strata)) 
-      cat(", stratified within", x$strata)
+    cat(howHead(x$control))
   }
-  cat("\n\n")
+  cat("\n")
   invisible(x)
 }
 

Modified: pkg/vegan/R/print.mrpp.R
===================================================================
--- pkg/vegan/R/print.mrpp.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/print.mrpp.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -28,9 +28,7 @@
         cat("Significance of delta:", format.pval(x$Pvalue), 
             "\n")
     }
-    cat("Based on ", nperm, " permutations")
-    if (!is.null(x$strata)) 
-        cat(", stratified within", x$strata)
-    cat("\n\n")
+    cat(howHead(x$control))
+    cat("\n")
     invisible(x)
 }

Modified: pkg/vegan/R/print.mso.R
===================================================================
--- pkg/vegan/R/print.mso.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/print.mso.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -4,6 +4,8 @@
     NextMethod("print", x, digits = digits, ...)
     cat("mso variogram:\n\n")
     print(x$vario, digits = digits, ...)
+    if(!is.null(attr(x$vario, "control")))
+        cat("\n", howHead(attr(x$vario, "control")), "\n", sep="")
     invisible(x)
 }
 

Modified: pkg/vegan/R/print.permutest.betadisper.R
===================================================================
--- pkg/vegan/R/print.permutest.betadisper.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/print.permutest.betadisper.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -5,7 +5,7 @@
     cat("\n")
     writeLines(strwrap("Permutation test for homogeneity of multivariate dispersions\n"))
     ##cat("\n")
-    print(x$control)
+    cat(howHead(x$control))
     nc <- dim(x$tab)[2]
     cn <- colnames(x$tab)
     has.P <- substr(cn[nc], 1, 3) == "Pr("

Modified: pkg/vegan/R/print.protest.R
===================================================================
--- pkg/vegan/R/print.protest.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/print.protest.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -8,7 +8,7 @@
   cat("Correlation in a symmetric Procrustes rotation: ")
   cat(formatC(x$t0, digits = digits), "\n")
   cat("Significance:  ")
-  cat(format.pval(x$signif),"\n")
+  cat(format.pval(x$signif),"\n\n")
   cat(howHead(x$control))
   cat("\n")
   invisible(x)

Modified: pkg/vegan/R/print.vectorfit.R
===================================================================
--- pkg/vegan/R/print.vectorfit.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/print.vectorfit.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -5,10 +5,7 @@
     printCoefmat(out, na.print = "",
                  zap.ind = seq_len(ncol(out)-2), ...)
     if (x$permutations) {
-        cat("P values based on", x$permutations, "permutations")
-        if (!is.null(x$strata)) 
-            cat(", stratified within", x$strata)
-        cat(".\n")
+        cat(howHead(x$control))
     }
     invisible(x)
 }

Modified: pkg/vegan/R/simper.R
===================================================================
--- pkg/vegan/R/simper.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/simper.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -100,6 +100,7 @@
     if (isParal && !isMulticore && !hasClus)
         stopCluster(parallel)
     attr(outlist, "permutations") <- nperm
+    attr(outlist, "control") <- attr(perm, "control")
     class(outlist) <- "simper"
     outlist
 }
@@ -141,6 +142,7 @@
     }
     attr(out, "digits") <- digits
     attr(out, "permutations") <- attr(object, "permutations")
+    attr(out, "control") <- attr(object, "control")
     class(out) <- "summary.simper"
     out
 }
@@ -167,8 +169,8 @@
                             symbols = c("***", "**", "*", ".", " ")), "legend")
         cat("---\nSignif. codes: ", leg, "\n")
     }
-    if ((np <- attr(x, "permutations")) > 0)
-        cat("P-values based on", np, "permutations\n")
+    if (!is.null(attr(x, "control")))
+        cat(howHead(attr(x, "control")))
     invisible(x)
 }
 

Modified: pkg/vegan/R/vectorfit.R
===================================================================
--- pkg/vegan/R/vectorfit.R	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/R/vectorfit.R	2014-09-16 14:13:14 UTC (rev 2883)
@@ -54,10 +54,7 @@
     else pvals <- NULL
     sol <- list(arrows = heads, r = r, permutations = permutations, 
                 pvals = pvals)
-    if (!missing(strata)) {
-        sol$strata <- deparse(substitute(strata))
-        sol$stratum.values <- strata
-    }
+    sol$control <- attr(permat, "control")
     class(sol) <- "vectorfit"
     sol
 }

Modified: pkg/vegan/man/CCorA.Rd
===================================================================
--- pkg/vegan/man/CCorA.Rd	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/man/CCorA.Rd	2014-09-16 14:13:14 UTC (rev 2883)
@@ -105,6 +105,8 @@
   \item{ corr.X.Cx }{ Scores of X variables in X biplot, computed as cor(X,Cx). }
   \item{ corr.Y.Cx }{ cor(Y,Cy) available for plotting variables Y in space of X manually. }
   \item{ corr.X.Cy }{ cor(X,Cx) available for plotting variables X in space of Y manually. }
+  \item{control}{A list of control values for the permutations
+    as returned by the function \code{\link[permute]{how}}.}
   \item{ call }{ Call to the CCorA function. }
 }
 

Modified: pkg/vegan/man/anosim.Rd
===================================================================
--- pkg/vegan/man/anosim.Rd	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/man/anosim.Rd	2014-09-16 14:13:14 UTC (rev 2883)
@@ -85,6 +85,8 @@
   \item{dis.rank}{Rank of dissimilarity entry.}
   \item{dissimilarity}{The name of the dissimilarity index: the
     \code{"method"} entry of the \code{dist} object.}
+  \item{control}{A list of control values for the permutations
+    as returned by the function \code{\link[permute]{how}}.}
 }
 \references{
   Clarke, K. R. (1993). Non-parametric multivariate analysis of changes

Modified: pkg/vegan/man/envfit.Rd
===================================================================
--- pkg/vegan/man/envfit.Rd	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/man/envfit.Rd	2014-09-16 14:13:14 UTC (rev 2883)
@@ -162,6 +162,8 @@
   \item{centroids}{Class centroids from \code{factorfit}.}
   \item{r}{Goodness of fit statistic: Squared correlation coefficient}
   \item{permutations}{Number of permutations.}
+  \item{control}{A list of control values for the permutations
+    as returned by the function \code{\link[permute]{how}}.}
   \item{pvals}{Empirical P-values for each variable.}
 
   Function \code{envfit} returns a list of class \code{envfit} with

Modified: pkg/vegan/man/mantel.Rd
===================================================================
--- pkg/vegan/man/mantel.Rd	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/man/mantel.Rd	2014-09-16 14:13:14 UTC (rev 2883)
@@ -73,6 +73,8 @@
     permuted values can be inspected with \code{\link{density.mantel}} 
     function.}
   \item{permutations}{Number of permutations.}
+  \item{control}{A list of control values for the permutations
+    as returned by the function \code{\link[permute]{how}}.}
 }
 \references{ The test is due to Mantel, of course, but the
   current implementation is based on Legendre and Legendre.

Modified: pkg/vegan/man/mrpp.Rd
===================================================================
--- pkg/vegan/man/mrpp.Rd	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/man/mrpp.Rd	2014-09-16 14:13:14 UTC (rev 2883)
@@ -148,6 +148,8 @@
     calculated from each of the permuted datasets. The distribution of
     this item can be inspected with \code{\link{density.mrpp}} function.}
   \item{permutations}{The number of permutations used.}
+  \item{control}{A list of control values for the permutations
+    as returned by the function \code{\link[permute]{how}}.}
 }
 \references{
   B. McCune and J. B. Grace. 2002. \emph{Analysis of Ecological

Modified: pkg/vegan/man/procrustes.Rd
===================================================================
--- pkg/vegan/man/procrustes.Rd	2014-09-16 07:13:05 UTC (rev 2882)
+++ pkg/vegan/man/procrustes.Rd	2014-09-16 14:13:14 UTC (rev 2883)
@@ -165,6 +165,8 @@
     function.}
   \item{signif}{`Significance' of \code{t}}
   \item{permutations}{Number of permutations.}
+  \item{control}{A list of control values for the permutations
+    as returned by the function \code{\link[permute]{how}}.}
   \item{control}{the list passed to argument \code{control} describing
     the permutation design.}
 }



More information about the Vegan-commits mailing list