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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Nov 12 11:59:50 CET 2010


Author: jarioksa
Date: 2010-11-12 11:59:50 +0100 (Fri, 12 Nov 2010)
New Revision: 1368

Modified:
   pkg/vegan/R/eigenvals.R
   pkg/vegan/inst/ChangeLog
Log:
eigenvals is ready for cmdscale() in R 2.12.1

Modified: pkg/vegan/R/eigenvals.R
===================================================================
--- pkg/vegan/R/eigenvals.R	2010-11-12 10:43:27 UTC (rev 1367)
+++ pkg/vegan/R/eigenvals.R	2010-11-12 10:59:50 UTC (rev 1368)
@@ -10,15 +10,19 @@
     function(x, ...)
 {
     ## svd and eigen return unspecified 'list', see if this could be
-    ## either of them
+    ## either of them (like does cmdscale)
     out <- NA
     if (is.list(x)) {
         ## eigen
         if (length(x) == 2 && all(names(x) %in% c("values", "vectors")))
             out <- x$values
         ## svd: return squares of singular values
-        if (length(x) == 3 && all(names(x) %in% c("d", "u", "v")))
+        else if (length(x) == 3 && all(names(x) %in% c("d", "u", "v")))
             out <- x$d^2
+        ## cmdscale() will return all eigenvalues from R  2.12.1
+        else if (getRversion() > "2.12.0" &&
+                 all(c("points","eig","GOF") %in% names(x)))
+            out <- x$eig
     }
     class(out) <- "eigenvals"
     out

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-11-12 10:43:27 UTC (rev 1367)
+++ pkg/vegan/inst/ChangeLog	2010-11-12 10:59:50 UTC (rev 1368)
@@ -30,7 +30,8 @@
 	eigenvals(), Gower and Mardia, Kent & Bibby.
 
 	* eigenvals: added a method for "pcnm" and docs discuss handling
-	negative eigenvalues in summary.eigenvals().
+	negative eigenvalues in summary.eigenvals(). Function is ready for
+	the new version of cmdscale() in R 2.12.1.
 
 	* prc: Cajo ter Braak wrote new code for more direct
 	implementation of PRC. This drops formula interface and directly



More information about the Vegan-commits mailing list