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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jun 28 11:28:58 CEST 2009


Author: gsimpson
Date: 2009-06-28 11:28:57 +0200 (Sun, 28 Jun 2009)
New Revision: 875

Modified:
   pkg/vegan/R/betadisper.R
   pkg/vegan/inst/ChangeLog
Log:
Fix bug in removal of eigenvectors associated with (effectively) zero eigenvalues.

Modified: pkg/vegan/R/betadisper.R
===================================================================
--- pkg/vegan/R/betadisper.R	2009-06-17 09:48:10 UTC (rev 874)
+++ pkg/vegan/R/betadisper.R	2009-06-28 09:28:57 UTC (rev 875)
@@ -44,10 +44,10 @@
     vectors <- e$vectors
     eig <- e$values
     ## Remove zero eigenvalues
-    eig <- eig[abs(eig/eig[1]) > TOL]
-    rs <- seq_along(eig)
+    eig <- eig[(want <- abs(eig/eig[1]) > TOL)]
+    ##rs <- seq_along(eig)
     ## scale Eigenvectors
-    vectors <- vectors[, rs, drop = FALSE] %*% diag(sqrt(abs(eig)))
+    vectors <- vectors[, want, drop = FALSE] %*% diag(sqrt(abs(eig)))
     ## store which are the positive eigenvalues
     pos <- eig > 0
     ## group centroids in PCoA space
@@ -80,7 +80,7 @@
     ## zij are the distances of each point to its group centroid
     zij <- sqrt(abs(dist.pos - dist.neg))
     ## add in correct labels
-    colnames(vectors) <- names(eig) <- paste("PCoA", rs, sep = "")
+    colnames(vectors) <- names(eig) <- paste("PCoA", seq_along(eig), sep = "")
     if(is.matrix(centroids))
         colnames(centroids) <- names(eig)
     else

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2009-06-17 09:48:10 UTC (rev 874)
+++ pkg/vegan/inst/ChangeLog	2009-06-28 09:28:57 UTC (rev 875)
@@ -8,7 +8,9 @@
 	on June 17, 2009.
 
 	* rrarefy: a new function to generate randomly rarefied
-	communities. 
+	communities.
+
+	* betadisper: fix bug in removal of (effectively) zero Eigenvalues.
 	
 Version 1.16-19 (closed June 17, 2009)
 



More information about the Vegan-commits mailing list