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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Feb 19 11:11:50 CET 2013


Author: jarioksa
Date: 2013-02-19 11:11:50 +0100 (Tue, 19 Feb 2013)
New Revision: 2447

Modified:
   pkg/vegan/R/metaMDSiter.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/metaMDS.Rd
Log:
expose argument 'maxit' so that users can set the no. of iterations in metaMDS

Modified: pkg/vegan/R/metaMDSiter.R
===================================================================
--- pkg/vegan/R/metaMDSiter.R	2013-02-17 14:30:49 UTC (rev 2446)
+++ pkg/vegan/R/metaMDSiter.R	2013-02-19 10:11:50 UTC (rev 2447)
@@ -1,6 +1,6 @@
 `metaMDSiter` <-
     function (dist, k = 2, trymax = 20, trace = 1, plot = FALSE, 
-              previous.best, engine = "monoMDS",
+              previous.best, engine = "monoMDS", maxit = 200,
               parallel = getOption("mc.cores"), ...) 
 {
     engine <- match.arg(engine, c("monoMDS", "isoMDS"))
@@ -50,8 +50,10 @@
     } else {
         ## no previous.best: start with cmdscale
         s0 <- switch(engine,
-                 "monoMDS" = monoMDS(dist, y = cmdscale(dist, k = k), k = k, ...),
-                 "isoMDS" = isoMDS(dist, k = k, trace = isotrace))
+                 "monoMDS" = monoMDS(dist, y = cmdscale(dist, k = k), k = k,
+                 maxit = maxit, ...),
+                 "isoMDS" = isoMDS(dist, k = k, trace = isotrace,
+                 maxit = maxit))
     }
     if (trace) 
         cat("Run 0 stress", s0$stress, "\n")
@@ -83,25 +85,26 @@
                     mclapply(1:nclus, function(i)
                              switch(engine,
                                     "monoMDS" = monoMDS(dist, init[,,i], k = k,
-                                    maxit = 200, ...),
+                                    maxit = maxit, ...),
                                     "isoMDS" = isoMDS(dist, init[,,i], k = k,
-                                    maxit = 200, tol = 1e-07, trace = isotrace)),
+                                    maxit = maxit, tol = 1e-07,
+                                    trace = isotrace)),
                              mc.cores = parallel)
             } else {
                 stry <-
                     parLapply(parallel, 1:nclus, function(i)
                               switch(engine,
                                      "monoMDS" = monoMDS(dist, init[,,i], k = k,
-                                     maxit = 200, ...),
+                                     maxit = maxit, ...),
                                      "isoMDS" = isoMDS(dist, init[,,i], k = k,
-                                     maxit = 200, tol = 1e-07, trace = isotrace)))
+                                     maxit = maxit, tol = 1e-07, trace = isotrace)))
             }
         } else {
             stry <- list(switch(engine,
                                 "monoMDS" = monoMDS(dist, init[,,1], k = k,
-                                maxit = 200, ...),
+                                maxit = maxit, ...),
                                 "isoMDS" = isoMDS(dist, init[,,1], k = k,
-                                maxit = 200, tol = 1e-07, trace = isotrace)))
+                                maxit = maxit, tol = 1e-07, trace = isotrace)))
         }
         ## analyse results of 'nclus' tries
         for (i in 1:nclus) {

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2013-02-17 14:30:49 UTC (rev 2446)
+++ pkg/vegan/inst/ChangeLog	2013-02-19 10:11:50 UTC (rev 2447)
@@ -7,6 +7,10 @@
 	* New version opened with the release of vegan_2.0-6 on February
 	11, 2013.
 
+	* metaMDS: exposed argument 'maxit' in metaMDSiter() so that users
+	can set the number of iterations in monoMDS() or isoMDS(). After a
+	wish by Jon Bakker, Univ Washington (U.S.A.).
+
 	* tabasco: a sister function of vegemite() to display a compact
 	community table using heatmap(). Both vegemite() and tabasco() can
 	handle cluster::agnes() trees.

Modified: pkg/vegan/man/metaMDS.Rd
===================================================================
--- pkg/vegan/man/metaMDS.Rd	2013-02-17 14:30:49 UTC (rev 2446)
+++ pkg/vegan/man/metaMDS.Rd	2013-02-19 10:11:50 UTC (rev 2447)
@@ -41,7 +41,8 @@
     noshare = TRUE, trace = 1, commname, zerodist = "ignore", 
     distfun = vegdist, ...)
 metaMDSiter(dist, k = 2, trymax = 20, trace = 1, plot = FALSE, 
-    previous.best, engine = "monoMDS", parallel = getOption("mc.cores"), ...)   
+    previous.best, engine = "monoMDS", maxit = 200,
+    parallel = getOption("mc.cores"), ...)   
 initMDS(x, k=2)
 postMDS(X, dist, pc=TRUE, center=TRUE, halfchange, threshold=0.8,
     nthreshold=10, plot=FALSE, ...)
@@ -120,6 +121,10 @@
    \code{dist} object and accepting argument \code{method} can be used
    (but some extra arguments may cause name conflicts).}
 
+ \item{maxit}{Maximum number of iterations in the single NMDS run;
+   passed to the \code{engine} function \code{\link{monoMDS}} or
+   \code{\link[MASS]{isoMDS}}.}
+
  \item{parallel}{Number of parallel processes or a predefined socket
    cluster.  If you use pre-defined socket clusters (say,
    \code{clus}), you must issue \code{clusterEvalQ(clus,



More information about the Vegan-commits mailing list