[Vegan-commits] r1769 - in pkg/vegan: R inst tests/Examples

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 28 21:17:14 CEST 2011


Author: jarioksa
Date: 2011-08-28 21:17:11 +0200 (Sun, 28 Aug 2011)
New Revision: 1769

Modified:
   pkg/vegan/R/monoMDS.R
   pkg/vegan/R/print.monoMDS.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/tests/Examples/vegan-Ex.Rout.save
Log:
save and display dist method and call in monoMDS

Modified: pkg/vegan/R/monoMDS.R
===================================================================
--- pkg/vegan/R/monoMDS.R	2011-08-28 17:15:05 UTC (rev 1768)
+++ pkg/vegan/R/monoMDS.R	2011-08-28 19:17:11 UTC (rev 1769)
@@ -6,6 +6,13 @@
              sratmax=0.99999, ...) 
 {
     model <- match.arg(model)
+    ## save 'dist' attributes to display in print()
+    distmethod <- attr(dist, "method")
+    if (is.null(distmethod))
+        distmethod <- "unknown"
+    distcall <-attr(dist, "call")
+    if (!is.null(distcall))
+        distcall <- deparse(distcall)
     ## dist to mat
     mat <- as.matrix(dist)
     nm <- rownames(mat)
@@ -112,6 +119,9 @@
     attr(sol$points, "pc") <- pc
     rownames(sol$points) <- nm
     colnames(sol$points) <- paste("MDS", 1:k, sep="")
+    ## save info on dissimilarities
+    sol$distmethod <- distmethod
+    sol$distcall <- distcall
     class(sol) <- "monoMDS"
     sol
 }

Modified: pkg/vegan/R/print.monoMDS.R
===================================================================
--- pkg/vegan/R/print.monoMDS.R	2011-08-28 17:15:05 UTC (rev 1768)
+++ pkg/vegan/R/print.monoMDS.R	2011-08-28 19:17:11 UTC (rev 1769)
@@ -10,7 +10,12 @@
                      local = "Local non-metric",
                      linear = "Linear",
                      hybrid = "Hybrid")
-    cat(paste(modlab, "Multidimensional Scaling\n"))
+    cat(paste(modlab, "Multidimensional Scaling\n\n"))
+    cat(x$nobj, "points")
+    cat(", dissimilarity", sQuote(x$distmethod))
+    if (!is.null(x$distcall))
+        cat(", call", sQuote(x$distcall))
+    cat("\n\n")
     cat("Dimensions:", x$ndim, "\n")
     cat("Stress:    ", x$stress, "\n")
     cat("Stress type", x$isform)

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-08-28 17:15:05 UTC (rev 1768)
+++ pkg/vegan/inst/ChangeLog	2011-08-28 19:17:11 UTC (rev 1769)
@@ -4,6 +4,9 @@
 
 Version 1.92-2 (opened August 28, 2011)
 
+	* monoMDS: saves and displays info on the dissimilarities used,
+	and displays the number of points.
+
 	* MDSrotate: metaMDSrotate() was renamed to MDSrotate(), and
 	metaMDSrotate() was .Deprecated. 
 	

Modified: pkg/vegan/tests/Examples/vegan-Ex.Rout.save
===================================================================
--- pkg/vegan/tests/Examples/vegan-Ex.Rout.save	2011-08-28 17:15:05 UTC (rev 1768)
+++ pkg/vegan/tests/Examples/vegan-Ex.Rout.save	2011-08-28 19:17:11 UTC (rev 1769)
@@ -161,7 +161,7 @@
 
 Formula:
 y ~ poly(x1, 1) + poly(x2, 1)
-<environment: 0x102383db8>
+<environment: 0x1023e4308>
 Total model degrees of freedom 3 
 
 GCV score: 0.0427924
@@ -3656,6 +3656,9 @@
 monoMDS(dist = dis, model = "loc") 
 
 Local non-metric Multidimensional Scaling
+
+20 points, dissimilarity ‘bray’, call ‘vegdist(x = dune)’
+
 Dimensions: 2 
 Stress:     0.07596768 
 Stress type 1, weak ties
@@ -4727,7 +4730,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x10684e8a0>
+<environment: 0x1069e28d8>
 
 Estimated degrees of freedom:
 6.4351  total = 7.435071 
@@ -4743,7 +4746,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x1067b0430>
+<environment: 0x10605cca0>
 
 Estimated degrees of freedom:
 6.1039  total = 7.103853 
@@ -4899,7 +4902,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x106c4c3f8>
+<environment: 0x104886878>
 
 Estimated degrees of freedom:
 8.9275  total = 9.927492 
@@ -4912,7 +4915,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x1069610b0>
+<environment: 0x107ad10a8>
 
 Estimated degrees of freedom:
 7.7529  total = 8.75294 
@@ -4925,7 +4928,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x106ba78b0>
+<environment: 0x1064e5600>
 
 Estimated degrees of freedom:
 8.8962  total = 9.89616 
@@ -7148,7 +7151,7 @@
 
 Formula:
 y ~ s(x1, x2, k = knots)
-<environment: 0x106ea3c78>
+<environment: 0x10797bd08>
 
 Estimated degrees of freedom:
 2  total = 3 
@@ -7613,7 +7616,7 @@
 > ### * <FOOTER>
 > ###
 > cat("Time elapsed: ", proc.time() - get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  148.95 1.66 152.883 0 0 
+Time elapsed:  110.491 1.395 117.643 0 0 
 > grDevices::dev.off()
 null device 
           1 



More information about the Vegan-commits mailing list