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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 10 12:23:51 CET 2011


Author: jarioksa
Date: 2011-03-10 12:23:51 +0100 (Thu, 10 Mar 2011)
New Revision: 1533

Modified:
   pkg/vegan/R/metaMDSrotate.R
   pkg/vegan/inst/ChangeLog
Log:
metaMDSrotate failed with >2dim, but no kind of handles them

Modified: pkg/vegan/R/metaMDSrotate.R
===================================================================
--- pkg/vegan/R/metaMDSrotate.R	2011-03-10 11:03:11 UTC (rev 1532)
+++ pkg/vegan/R/metaMDSrotate.R	2011-03-10 11:23:51 UTC (rev 1533)
@@ -6,6 +6,9 @@
         stop("function works only with 'metaMDS' results")
     if (length(choices) != 2)
         stop("function can be only used with 2dim plots")
+    if (NCOL(object$points) > 2)
+        warning(gettextf("only two of %d axes are rotated",
+                         NCOL(object$points)))
     vec <- drop(vec)
     if (length(dim(vec)) > 1)
         stop("function works only with univariate 'x'")
@@ -18,10 +21,12 @@
     ## transpose (inverse) of the rotation matrix
     rot <- t(rot)
     ## Rotation of points and species scores
-    object$points[] <- object$points %*% rot
+    object$points[, choices] <-
+        object$points[, choices, drop=FALSE] %*% rot
     attr(object$points, "pc") <- FALSE
     if (!is.null(object$species))
-        object$species[] <- object$species %*% rot
+        object$species[, choices] <-
+            object$species[, choices, drop=FALSE] %*% rot
     object
 }
 

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-03-10 11:03:11 UTC (rev 1532)
+++ pkg/vegan/inst/ChangeLog	2011-03-10 11:23:51 UTC (rev 1533)
@@ -6,6 +6,15 @@
 
 	* ordisurf: got a formula interface as an alternative to define
 	the model.
+
+	* metaMDSrotate: function can only rotate two dimensions. It was
+	supposed to be able to pick two dimensions from multidimensional
+	solutions, but failed. Now it really rotates two dimensions, and
+	lefts the rest as unrotated instead of destroying them and only
+	returning the two axes. Needs improvement if we want to have this
+	as a generic function. Indeed, JO had great doubts about releasing
+	this function, but then light-mindedly let it go to 1.16-14 &
+	1.17-0.
 	
 Version 1.18-24 (closed March 10, 2011)
 



More information about the Vegan-commits mailing list