[Vegan-commits] r2371 - in branches/2.0: R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 15 09:34:47 CET 2013


Author: jarioksa
Date: 2013-01-15 09:34:47 +0100 (Tue, 15 Jan 2013)
New Revision: 2371

Modified:
   branches/2.0/R/clamtest.R
   branches/2.0/R/print.mantel.R
   branches/2.0/R/summary.anosim.R
   branches/2.0/inst/ChangeLog
Log:
merge r2367 (mantel, anosim print) aand r2369 (clamtest fixes)

Modified: branches/2.0/R/clamtest.R
===================================================================
--- branches/2.0/R/clamtest.R	2013-01-15 08:13:02 UTC (rev 2370)
+++ branches/2.0/R/clamtest.R	2013-01-15 08:34:47 UTC (rev 2371)
@@ -19,7 +19,7 @@
         stop("number of groups must be 2")
     glabel <- as.character(unique(groups))
     if (is.null(colnames(comm)))
-        colnames(comm) <- paste("Species", 1:nrow(comm), sep=".")
+        colnames(comm) <- paste("Species", 1:ncol(comm), sep=".")
     if (any(colSums(comm) <= 0))
         stop("'comm' contains zero sum columns")
     spp <- colnames(comm)
@@ -73,14 +73,28 @@
     ## finding Xmin and Ymin values for Xseq and Yseq
     Xmins <- sapply(Yseq, function(z) rootfun(z, C1, C2, n, m, upper=max(X)))
     Ymins <- sapply(Xseq, function(z) rootfun(z, C2, C1, m, n, upper=max(Y)))
+
+    ## needed to tweak original set of rules (extreme case reported
+    ## by Richard Telford failed here)
+    if (all(is.na(Xmins)))
+        Xmins[1] <- 1
+    if (all(is.na(Ymins)))
+        Ymins[1] <- 1
+
     minval <- list(data.frame(x=Xseq[!is.na(Ymins)], y=Ymins[!is.na(Ymins)]),
         data.frame(x=Xmins[!is.na(Xmins)], y=Yseq[!is.na(Xmins)]))
+
     ## shared but too rare
     Ymin <- Ymins[1]
     Xmin <- Xmins[1]
     sr <- X < Xmin & Y < Ymin
-    tmp1 <- approx(c(Xmin, 1), c(1, Ymin), xout=1:Xmin)
-    tmp2 <- approx(c(1, Ymin), c(Xmin, 1), xout=1:Ymin)
+
+    ## consequence of manually setting Xmin/Ymin resolved here
+    tmp1 <- if (Xmin==1)
+        list(x=1, y=Xmin) else approx(c(Xmin, 1), c(1, Ymin), xout=1:Xmin)
+    tmp2 <- if (Ymin==1)
+        list(x=1, y=Ymin) else approx(c(1, Ymin), c(Xmin, 1), xout=1:Ymin)
+
     for (i in 1:S) {
         if (X[i] %in% tmp1$x)
             sr[i] <- Y[i] < tmp1$y[which(X[i]==tmp1$x)]

Modified: branches/2.0/R/print.mantel.R
===================================================================
--- branches/2.0/R/print.mantel.R	2013-01-15 08:13:02 UTC (rev 2370)
+++ branches/2.0/R/print.mantel.R	2013-01-15 08:34:47 UTC (rev 2371)
@@ -1,4 +1,4 @@
-"print.mantel" <-
+`print.mantel` <-
   function (x, digits = max(3, getOption("digits") - 3), ...) 
 {
   cat("\n")
@@ -14,7 +14,7 @@
     cat("      Significance:", format.pval(x$signif), 
         "\n\n")
     out <- quantile(x$perm, c(0.9, 0.95, 0.975, 0.99))
-    cat("Empirical upper confidence limits of r:\n")
+    cat("Upper quantiles of permutations (null model):\n")
     print(out, digits = 3)
     cat("\nBased on", nperm, "permutations")
     if (!is.null(x$strata)) 

Modified: branches/2.0/R/summary.anosim.R
===================================================================
--- branches/2.0/R/summary.anosim.R	2013-01-15 08:13:02 UTC (rev 2370)
+++ branches/2.0/R/summary.anosim.R	2013-01-15 08:34:47 UTC (rev 2371)
@@ -1,10 +1,10 @@
-"summary.anosim" <-
+`summary.anosim` <-
 function (object, ...) 
 {
    print(object)
    if (object$permutations) {
      out <- quantile(object$perm, c(0.9, 0.95, 0.975, 0.99))
-     cat("Empirical upper confidence limits of R:\n")
+     cat("Upper quantiles of permutations (null model):\n")
      print(out, digits=3)
    }
    cat("\n")

Modified: branches/2.0/inst/ChangeLog
===================================================================
--- branches/2.0/inst/ChangeLog	2013-01-15 08:13:02 UTC (rev 2370)
+++ branches/2.0/inst/ChangeLog	2013-01-15 08:34:47 UTC (rev 2371)
@@ -4,6 +4,8 @@
 
 Version 2.0-6 (opened October 8, 2012)
 
+	* merge 2369: clamtest fix and border cases.
+	* merge 2367: rectify mantel, summary.anosim print.
 	* merge 2362: doc on r2357 for capscale.
 	* merge 2361: adjust imaginary axes similarly as real eigenvalue. 
 	* merge 2357: print additive constant in capscale.



More information about the Vegan-commits mailing list