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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Mar 14 08:06:44 CET 2010


Author: jarioksa
Date: 2010-03-14 08:06:42 +0100 (Sun, 14 Mar 2010)
New Revision: 1174

Modified:
   pkg/vegan/R/scores.cca.R
   pkg/vegan/R/scores.rda.R
   pkg/vegan/inst/ChangeLog
Log:
scores() of rda/cca/capscale will alwways have names even if data have none

Modified: pkg/vegan/R/scores.cca.R
===================================================================
--- pkg/vegan/R/scores.cca.R	2010-03-08 15:56:13 UTC (rev 1173)
+++ pkg/vegan/R/scores.cca.R	2010-03-14 07:06:42 UTC (rev 1174)
@@ -90,6 +90,14 @@
             sol$centroids <- cn
         }
     }
+    ## Take care that scores have names
+    for (i in 1:length(sol)) {
+        if (is.matrix(sol[[i]])) 
+            rownames(sol[[i]]) <-
+                rownames(sol[[i]], do.NULL = FALSE, 
+                         prefix = substr(names(sol)[i], 1, 3))
+    }
+    ## Only one type of scores: return a matrix instead of a list
     if (length(sol) == 1) 
         sol <- sol[[1]]
     return(sol)

Modified: pkg/vegan/R/scores.rda.R
===================================================================
--- pkg/vegan/R/scores.rda.R	2010-03-08 15:56:13 UTC (rev 1173)
+++ pkg/vegan/R/scores.rda.R	2010-03-14 07:06:42 UTC (rev 1174)
@@ -82,7 +82,15 @@
             }
             sol$centroids <- cn
         }
-    }  
+    }
+    ## Take care that scores have names
+    for (i in 1:length(sol)) {
+        if (is.matrix(sol[[i]])) 
+            rownames(sol[[i]]) <-
+                rownames(sol[[i]], do.NULL = FALSE, 
+                         prefix = substr(names(sol)[i], 1, 3))
+    }
+    ## Only one type of scores: return a matrix instead of a list
     if (length(sol) == 1) 
         sol <- sol[[1]]
     attr(sol, "const") <- const

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-03-08 15:56:13 UTC (rev 1173)
+++ pkg/vegan/inst/ChangeLog	2010-03-14 07:06:42 UTC (rev 1174)
@@ -9,6 +9,12 @@
 
 	* DESCRIPTION: Corrected the name of Bob O'Hara (also in release
 	1.17-2). 
+
+	* scores.cca/scores.rda: scores will always have names even if the
+	input data have no names. This fixes some display issues that
+	Pierre Legendre had with biplot.rda(), and makes redundant the
+	name checking code in summary.cca (the redundant code was not yet
+	removed, but I see that this fix here was sound).
 	
 Version 1.18-2 (closed March 8, 2010)
 



More information about the Vegan-commits mailing list