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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 27 11:15:01 CEST 2013


Author: jarioksa
Date: 2013-06-27 11:15:00 +0200 (Thu, 27 Jun 2013)
New Revision: 2538

Modified:
   pkg/vegan/R/stressplot.R
   pkg/vegan/inst/ChangeLog
Log:
stressplot use expression(R^2) instead of R2

Modified: pkg/vegan/R/stressplot.R
===================================================================
--- pkg/vegan/R/stressplot.R	2013-06-26 22:58:58 UTC (rev 2537)
+++ pkg/vegan/R/stressplot.R	2013-06-27 09:15:00 UTC (rev 2538)
@@ -61,9 +61,12 @@
     ## Stress as R2
     rstress <- 1 - object$stress^2
     ralscal <- if(object$iregn == 3) ralscal/2 else ralscal/object$ngrp
-    lab <- paste("Non-metric fit, R2 =", format(rstress, digits=3),
-                 "\nLinear fit, R2 =", format(ralscal, digits=3))
-    text(min(x), 0.95*max(y), lab, pos=4)
+    Rst <- format(rstress, digits = 3)
+    Ral <- format(ralscal, digits = 3)
+    lab1 <- bquote("Non-metric fit, " * R^2 == .(Rst))
+    lab2 <- bquote("Linear fit, " * R^2 == .(Ral))
+    text(min(x), 0.95*max(y), lab1, pos=4)
+    text(min(x), 0.95*max(y) - strheight(lab1), lab2, pos=4)
     invisible(list("x" = x, "y" = y, "yf" = yf))
 }
     
@@ -94,8 +97,11 @@
     plot(shep, pch = pch, col = p.col, xlab = "Observed Dissimilarity",
          ylab = "Ordination Distance", ...)
     lines(shep$x, shep$yf, type = "S", col = l.col, lwd = lwd, ...)
-    lab <- paste("Non-metric fit, R2 =", format(rstress, digits=3),
-               "\nLinear fit, R2 =", format(ralscal, digits=3))
-    text(min(shep$x), 0.95*max(shep$y), lab, pos=4)
+    Rst <- format(rstress, digits = 3)
+    Ral <- format(ralscal, digits = 3)
+    lab1 <- bquote("Non-metric fit, " * R^2 == .(Rst))
+    lab2 <- bquote("Linear fit, " * R^2 == .(Ral))
+    text(min(shep$x), 0.95*max(shep$y), lab1, pos=4)
+    text(min(shep$x), 0.95*max(shep$y) - strheight(lab1), lab2, pos=4)
     invisible(shep)
 }

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2013-06-26 22:58:58 UTC (rev 2537)
+++ pkg/vegan/inst/ChangeLog	2013-06-27 09:15:00 UTC (rev 2538)
@@ -44,6 +44,9 @@
         parameters. This allows it to fit more naturally into a standard
         R workflow (it plays nicely with `layout()` for example.
 
+	* stressplot: metaMDS and monoMDS stressplot() use now
+	expression(R^2) instead of ascii R2. 
+
 Version 2.1-30 (opened May 5, 2013)
 
 	* bioenv: can now use Mahalanobis, Manhattan and Gower distances



More information about the Vegan-commits mailing list