[Vegan-commits] r545 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Nov 2 16:56:02 CET 2008


Author: jarioksa
Date: 2008-11-02 16:56:02 +0100 (Sun, 02 Nov 2008)
New Revision: 545

Modified:
   pkg/R/nesteddisc.R
Log:
nesteddisc: (undocumented) 'order' item returns the order uses the original species index instead of the sorted internal index

Modified: pkg/R/nesteddisc.R
===================================================================
--- pkg/R/nesteddisc.R	2008-11-02 04:53:52 UTC (rev 544)
+++ pkg/R/nesteddisc.R	2008-11-02 15:56:02 UTC (rev 545)
@@ -10,16 +10,16 @@
 
     ## starting values and CONSTANTS
     NALL <- 7
-	NITER <- 5000
+    NITER <- 5000
     ties <- FALSE
     trace <- FALSE
     ## Code
     comm <- ifelse(comm > 0, 1, 0)
     cs <- colSums(comm)
-    j <- rev(order(cs))
+    k <- rev(order(cs))
     ## initial order
-    cs <- cs[j]
-    comm <- comm[, j]
+    cs <- cs[k]
+    comm <- comm[, k]
     ## run lengths: numbers of tied values
     le <- rle(cs)$lengths
     cle <- cumsum(le)
@@ -58,7 +58,7 @@
             }
         }
     }
-    out <- list(statistic=Ad, ties = ties, order = x)
+    out <- list(statistic=Ad, ties = ties, order = k[x])
     class(out) <- "nesteddisc"
     out
 }



More information about the Vegan-commits mailing list