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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Mar 1 18:30:51 CET 2013


Author: jarioksa
Date: 2013-03-01 18:30:51 +0100 (Fri, 01 Mar 2013)
New Revision: 2457

Modified:
   branches/2.0/R/nestedtemp.R
   branches/2.0/R/points.cca.R
   branches/2.0/R/print.monoMDS.R
   branches/2.0/R/text.cca.R
   branches/2.0/inst/ChangeLog
   branches/2.0/man/plot.cca.Rd
Log:
merge small fixes to vegan 2.0-7 (2448 partly, 2449, 2452, 2453)

- print metaMDS explains clearer the stopping criteria (r2448, 2449)
- plot/text.cca gained argument axis.bp = TRUE (r2452)
- nestedtemp failed with fill < 0.38% (r2453)


Modified: branches/2.0/R/nestedtemp.R
===================================================================
--- branches/2.0/R/nestedtemp.R	2013-03-01 03:56:33 UTC (rev 2456)
+++ branches/2.0/R/nestedtemp.R	2013-03-01 17:30:51 UTC (rev 2457)
@@ -48,7 +48,23 @@
     fillfun <- function(x, p) 1 - (1-(1-x)^p)^(1/p)
     intfun <- function(p, fill)
         integrate(fillfun, lower=0, upper=1, p=p)$value - fill
-    p <- uniroot(intfun, c(0,20), fill=fill)$root
+    ## 'p' will depend on 'fill', and fill = 0.0038 correspond to p =
+    ## 20. Sometimes the fill is lower, and therefore we try() to see
+    ## if we need to move the bracket up. We should need to do this
+    ## very rarely.
+    lo <- 0
+    hi <- 20
+    repeat{
+        sol <- try(uniroot(intfun, c(lo,hi), fill=fill), silent = TRUE)
+        if (inherits(sol, "try-error")) {
+            if (hi > 640) # bail out
+                stop(gettextf("matrix is too sparse, fill is %g"), fill)
+            lo <- hi
+            hi <- hi + hi
+        } else
+            break
+    }
+    p <- sol$root
     ## row coordinates of the fill line for all matrix entries
     out <- matrix(0, nrow=length(r), ncol=length(c))
     for (i in 1:length(r))

Modified: branches/2.0/R/points.cca.R
===================================================================
--- branches/2.0/R/points.cca.R	2013-03-01 03:56:33 UTC (rev 2456)
+++ branches/2.0/R/points.cca.R	2013-03-01 17:30:51 UTC (rev 2457)
@@ -1,6 +1,6 @@
 `points.cca` <-
     function (x, display = "sites", choices = c(1, 2), scaling = 2,
-              arrow.mul, head.arrow = 0.05, select, const, ...)
+              arrow.mul, head.arrow = 0.05, select, const, axis.bp = TRUE, ...)
 {
     formals(arrows) <- c(formals(arrows), alist(... = ))
     if (length(display) > 1)
@@ -28,10 +28,12 @@
         arrows(0, 0, pts[, 1], pts[, 2], length = head.arrow,
                ...)
         pts <- pts * 1.1
-        axis(3, at = c(-arrow.mul, 0, arrow.mul), labels = rep("",
-                                                  3))
-        axis(4, at = c(-arrow.mul, 0, arrow.mul), labels = c(-1,
-                                                  0, 1))
+        if (axis.bp) {
+            axis(3, at = c(-arrow.mul, 0, arrow.mul),
+                 labels = rep("", 3))
+            axis(4, at = c(-arrow.mul, 0, arrow.mul),
+                 labels = c(-1, 0, 1))
+        }
         return(invisible())
     }
     points(pts, ...)

Modified: branches/2.0/R/print.monoMDS.R
===================================================================
--- branches/2.0/R/print.monoMDS.R	2013-03-01 03:56:33 UTC (rev 2456)
+++ branches/2.0/R/print.monoMDS.R	2013-03-01 17:30:51 UTC (rev 2457)
@@ -31,10 +31,10 @@
         cat(", rotated to principal components")
     cat("\n")
     stoplab <- switch(x$icause,
-                      "Maximum number of iteration reached",
-                      "Stress nearly zero",
-                      "Stress nearly unchanged",
-                      "Scale factor of gradient nearly zero")
+                      "Maximum number of iterations (maxit) reached",
+                      "Stress nearly zero (< smin)",
+                      "Stress nearly unchanged (ratio > sratmax)",
+                      "Scale factor of gradient nearly zero (< sfgrmin)")
     cat("Stopped after ", x$iters, " iterations: ", stoplab, "\n", sep="")
     invisible(x)
 }

Modified: branches/2.0/R/text.cca.R
===================================================================
--- branches/2.0/R/text.cca.R	2013-03-01 03:56:33 UTC (rev 2456)
+++ branches/2.0/R/text.cca.R	2013-03-01 17:30:51 UTC (rev 2457)
@@ -1,6 +1,6 @@
 `text.cca` <-
     function (x, display = "sites", labels, choices = c(1, 2), scaling = 2,
-              arrow.mul, head.arrow = 0.05, select, const, ...)
+              arrow.mul, head.arrow = 0.05, select, const, axis.bp = TRUE, ...)
 {
     formals(arrows) <- c(formals(arrows), alist(... = ))
     if (length(display) > 1)
@@ -30,10 +30,12 @@
         arrows(0, 0, pts[, 1], pts[, 2], length = head.arrow,
                ...)
         pts <- pts * 1.1
-        axis(3, at = c(-arrow.mul, 0, arrow.mul), labels = rep("",
-                                                  3))
-        axis(4, at = c(-arrow.mul, 0, arrow.mul), labels = c(-1,
-                                                  0, 1))
+        if (axis.bp) {
+            axis(side = 3, at = c(-arrow.mul, 0, arrow.mul),
+                 labels = rep("", 3))
+            axis(side = 4, at = c(-arrow.mul, 0, arrow.mul),
+                 labels = c(-1, 0, 1))
+        }
     }
     text(pts, labels = rownames(pts), ...)
     invisible()

Modified: branches/2.0/inst/ChangeLog
===================================================================
--- branches/2.0/inst/ChangeLog	2013-03-01 03:56:33 UTC (rev 2456)
+++ branches/2.0/inst/ChangeLog	2013-03-01 17:30:51 UTC (rev 2457)
@@ -4,6 +4,10 @@
 
 Version 2.0-7 (opened February 17, 2013)
 
+	* merge r2453: nestedtemp failed with fill < 0.38%
+	* merge r2452: plot/text.cca gained axis.bp = TRUE argument. 
+	* merge r2448 (partly), 2449: print.monoMDS clearer about
+	convergence. Only this part merged: metaMDSiter untouched.
 	* merge r2443: edit cca.object.Rd.
 	* merge r2434: return wcmdscale object always with non-default
 	arguments.

Modified: branches/2.0/man/plot.cca.Rd
===================================================================
--- branches/2.0/man/plot.cca.Rd	2013-03-01 03:56:33 UTC (rev 2456)
+++ branches/2.0/man/plot.cca.Rd	2013-03-01 17:30:51 UTC (rev 2457)
@@ -21,9 +21,9 @@
 \method{plot}{cca}(x, choices = c(1, 2), display = c("sp", "wa", "cn"),
          scaling = 2, type, xlim, ylim, const, ...)
 \method{text}{cca}(x, display = "sites", labels, choices = c(1, 2), scaling = 2,
-    arrow.mul, head.arrow = 0.05, select, const, ...)
+    arrow.mul, head.arrow = 0.05, select, const, axis.bp = TRUE, ...)
 \method{points}{cca}(x, display = "sites", choices = c(1, 2), scaling = 2,
-    arrow.mul, head.arrow = 0.05, select, const, ...)
+    arrow.mul, head.arrow = 0.05, select, const, axis.bp = TRUE, ...)
 \method{scores}{cca}(x, choices=c(1,2), display=c("sp","wa","cn"), scaling=2, ...)
 \method{scores}{rda}(x, choices=c(1,2), display=c("sp","wa","cn"), scaling=2, 
     const, ...)
@@ -74,6 +74,7 @@
     \samp{decision-vegan.pdf} with \code{\link{vegandocs}} for details
     and discussion). If \code{const} is a vector of two items, the first
     is used for species, and the second item for site scores.}
+  \item{axis.bp}{Draw \code{\link{axis}} for biplot arrows.}
   \item{axes}{Number of axes in summaries.}
   \item{digits}{Number of digits in output.}
   \item{n, head, tail}{Number of rows printed from the head and tail of



More information about the Vegan-commits mailing list