[Vegan-commits] r876 - branches/1.15/R

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


Author: gsimpson
Date: 2009-06-28 11:32:35 +0200 (Sun, 28 Jun 2009)
New Revision: 876

Modified:
   branches/1.15/R/betadisper.R
Log:
merge r875 to 1.15 branch

Modified: branches/1.15/R/betadisper.R
===================================================================
--- branches/1.15/R/betadisper.R	2009-06-28 09:28:57 UTC (rev 875)
+++ branches/1.15/R/betadisper.R	2009-06-28 09:32:35 UTC (rev 876)
@@ -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



More information about the Vegan-commits mailing list