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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon May 16 22:05:41 CEST 2011


Author: jarioksa
Date: 2011-05-16 22:05:40 +0200 (Mon, 16 May 2011)
New Revision: 1602

Modified:
   pkg/vegan/R/scores.cca.R
   pkg/vegan/R/scores.rda.R
   pkg/vegan/inst/ChangeLog
Log:
scores.cca/rda failed if user asked only for non-existing scores

Modified: pkg/vegan/R/scores.cca.R
===================================================================
--- pkg/vegan/R/scores.cca.R	2011-05-12 14:38:42 UTC (rev 1601)
+++ pkg/vegan/R/scores.cca.R	2011-05-16 20:05:40 UTC (rev 1602)
@@ -91,11 +91,13 @@
         }
     }
     ## 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))
+    if (length(sol)) {
+        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) 

Modified: pkg/vegan/R/scores.rda.R
===================================================================
--- pkg/vegan/R/scores.rda.R	2011-05-12 14:38:42 UTC (rev 1601)
+++ pkg/vegan/R/scores.rda.R	2011-05-16 20:05:40 UTC (rev 1602)
@@ -94,11 +94,13 @@
         }
     }
     ## 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))
+    if (length(sol)) {
+        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) 

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-05-12 14:38:42 UTC (rev 1601)
+++ pkg/vegan/inst/ChangeLog	2011-05-16 20:05:40 UTC (rev 1602)
@@ -12,6 +12,10 @@
 	functions ourselves within released vegan code).
 
 	* treeheight: dramatic simplification and speed-up of the code.
+
+	* scores.cca/rda: failed if user requested only non-existing
+	scores. Now return an empty list of scores instead (with possible
+	attributes). 
 	
 Version 1.18-29 (closed April 27, 2011)
 



More information about the Vegan-commits mailing list