[Vegan-commits] r2116 - in branches/2.0: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Mar 2 12:07:56 CET 2012


Author: jarioksa
Date: 2012-03-02 12:07:56 +0100 (Fri, 02 Mar 2012)
New Revision: 2116

Modified:
   branches/2.0/R/simper.R
   branches/2.0/inst/ChangeLog
   branches/2.0/man/simper.Rd
Log:
merge r2115: githug EDiLD/vegan fixes for simper() by Eduard Sz?\195?\182cz

Modified: branches/2.0/R/simper.R
===================================================================
--- branches/2.0/R/simper.R	2012-03-02 10:48:35 UTC (rev 2115)
+++ branches/2.0/R/simper.R	2012-03-02 11:07:56 UTC (rev 2116)
@@ -36,7 +36,7 @@
                 contr[(j-1)*n.a+k, ] <- md / sum(me)	
             }
         }
-        average <- colMeans(contr) * 100
+        average <- colMeans(contr)
         
         if(nperm > 0){
             if (trace)
@@ -53,7 +53,7 @@
                         contrp[(j-1)*n.a+k, ] <- mdp / sum(mep)  
                     }
                 }
-                perm.contr[ ,p] <- colMeans(contrp) * 100
+                perm.contr[ ,p] <- colMeans(contrp)
             }
         p <- (apply(apply(perm.contr, 2, function(x) x >= average), 1, sum) + 1) / (nperm + 1)
         } 
@@ -64,13 +64,13 @@
         overall <- sum(average)
         sdi <- apply(contr, 2, sd)
         ratio <- average / sdi
-        av.a <- colMeans(group.a)
-        av.b <- colMeans(group.b) 
+        ava <- colMeans(group.a)
+        avb <- colMeans(group.b) 
         ord <- order(average, decreasing = TRUE)
-        cusum <- cumsum(average[ord] / overall * 100)
+        cusum <- cumsum(average[ord] / overall)
         out <- list(species = colnames(comm), average = average,
-                    overall = overall, sd = sdi, ratio = ratio, ava = av.a,
-                    avb = av.b, ord = ord, cusum = cusum, p = p)
+                    overall = overall, sd = sdi, ratio = ratio, ava = ava,
+                    avb = avb, ord = ord, cusum = cusum, p = p)
         outlist[[paste(comp[i,1], "_", comp[i,2], sep = "")]] <- out
     }
     attr(outlist, "permutations") <- nperm
@@ -88,7 +88,7 @@
         names(cusum[[i]]) <- spec[[i]]
     }
     ## this probably fails with empty or identical groups that have 0/0 = NaN
-    out <- lapply(cusum, function(z) z[seq_len(min(which(z >= 70)))])
+    out <- lapply(cusum, function(z) z[seq_len(min(which(z >= 0.7)))])
     print(out)
     invisible(x)
 }
@@ -107,7 +107,7 @@
         } 
     } 
     else {
-        out <- lapply(object, function(z) data.frame(cbind(contr = z$average, sd = z$sd, 'contr/sd' = z$ratio, av.a = z$ava, av.b = z$avb, p = z$p)))
+        out <- lapply(object, function(z) data.frame(cbind(contr = z$average, sd = z$sd, 'contr/sd' = z$ratio, ava = z$ava, avb = z$avb, p = z$p)))
     }
     attr(out, "digits") <- digits
     attr(out, "permutations") <- attr(object, "permutations")
@@ -140,4 +140,4 @@
     if ((np <- attr(x, "permutations")) > 0)
         cat("P-values based on", np, "permutations\n")
     invisible(x)
-}
+}
\ No newline at end of file

Modified: branches/2.0/inst/ChangeLog
===================================================================
--- branches/2.0/inst/ChangeLog	2012-03-02 10:48:35 UTC (rev 2115)
+++ branches/2.0/inst/ChangeLog	2012-03-02 11:07:56 UTC (rev 2116)
@@ -5,6 +5,8 @@
 Version 2.0-3 (opened November 13, 2011)
 
 	* copy simper.R & simper.Rd at r2092.
+	* merge r2115: simper fixes from github EDiLD/vegan pull request
+	#6 by Eduard Szöcz (proportions instead of percentages etc.)
 	* merge r2113: tweak simper.Rd formatting.
 	* commit r2112: deactivate permutation tests in simper.
 	* merge r2110: centroids.cca fix for 2-level factors as the only

Modified: branches/2.0/man/simper.Rd
===================================================================
--- branches/2.0/man/simper.Rd	2012-03-02 10:48:35 UTC (rev 2115)
+++ branches/2.0/man/simper.Rd	2012-03-02 11:07:56 UTC (rev 2116)
@@ -40,7 +40,7 @@
   \eqn{d_{jk}=\sum_{i=1}^S d_{ijk}}{d[jk] = sum(i=1..S) d[ijk]}. 
   
   The \code{simper} functions performs pairwise comparisons of groups
-  of sampling units and finds the average percentage contributions
+  of sampling units and finds the average contributions
   of each species to the average overall Bray-Curtis dissimilarity.
 
   The function displays most important species for each pair of
@@ -57,14 +57,14 @@
 \value{
   A list of class \code{"simper"} with following items:
   \item{species}{The species names.}
-  \item{average}{average contribution to overall dissimilarity.}
-  \item{overall}{The overall between-group dissimilarity (times 100).} 
-  \item{sd}{standard deviation of contribution.} 
-  \item{ratio}{mean to sd ratio.}
-  \item{ava, avb}{average abundances per group.}
+  \item{average}{Average contribution to overall dissimilarity.}
+  \item{overall}{The overall between-group dissimilarity.} 
+  \item{sd}{Standard deviation of contribution.} 
+  \item{ratio}{Average to sd ratio.}
+  \item{ava, avb}{Average abundances per group.}
   \item{ord}{An index vector to order vectors by their contribution or
     order \code{cusum} back to the original data order.}
-  \item{cusum}{Ordered cumulative per cent contribution.}
+  \item{cusum}{Ordered cumulative contribution.}
 }
 
 \examples{



More information about the Vegan-commits mailing list