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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Feb 12 08:55:18 CET 2012


Author: jarioksa
Date: 2012-02-12 08:55:17 +0100 (Sun, 12 Feb 2012)
New Revision: 2085

Modified:
   pkg/vegan/R/simper.R
   pkg/vegan/inst/ChangeLog
Log:
remove innermost loop in simper

Modified: pkg/vegan/R/simper.R
===================================================================
--- pkg/vegan/R/simper.R	2012-02-12 07:38:29 UTC (rev 2084)
+++ pkg/vegan/R/simper.R	2012-02-12 07:55:17 UTC (rev 2085)
@@ -44,16 +44,12 @@
         n.a <- nrow(group.a)
         n.b <- nrow(group.b)
         P <- ncol(comm)
-        me <- matrix(ncol = P)    	
-        md <- matrix(ncol = P)
         contr <- matrix(ncol = P, nrow = n.a * n.b)
         for(j in 1:n.b) {
             for(k in 1:n.a) {
-                for(s in 1:P) {
-                    md[s] <- abs(group.a[k, s] - group.b[j, s])
-                    me[s] <- group.a[k, s] + group.b[j, s]
-                    contr[(j-1)*n.a+k, ] <- md / rowSums(me)	
-                }
+                md <- abs(group.a[k, ] - group.b[j, ])
+                me <- group.a[k, ] + group.b[j, ]
+                contr[(j-1)*n.a+k, ] <- md / sum(me)	
             }
         }
         av.contr <- apply(contr, 2, mean) * 100

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2012-02-12 07:38:29 UTC (rev 2084)
+++ pkg/vegan/inst/ChangeLog	2012-02-12 07:55:17 UTC (rev 2085)
@@ -5,7 +5,7 @@
 Version 2.1-12 (opened February 9, 2012)
 	
 	* simper: new function to implement "similarity percentages" of
-	Clarke (Austral Ecology 18, 117-143; 1993) contributed by Eduard
+	Clarke (Austral. J. Ecol. 18, 117-143; 1993) contributed by Eduard
 	Szöcz (Uni Landau, Germany).
 
 Version 2.1-11 (closed February 9, 2012)



More information about the Vegan-commits mailing list