[Vegan-commits] r2972 - pkg/vegan/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Oct 23 11:33:00 CEST 2015


Author: jarioksa
Date: 2015-10-23 11:33:00 +0200 (Fri, 23 Oct 2015)
New Revision: 2972

Modified:
   pkg/vegan/R/ordicluster.R
Log:
Merge branch 'cran-2.3' into r-forge-svn-local

Modified: pkg/vegan/R/ordicluster.R
===================================================================
--- pkg/vegan/R/ordicluster.R	2015-10-15 12:42:28 UTC (rev 2971)
+++ pkg/vegan/R/ordicluster.R	2015-10-23 09:33:00 UTC (rev 2972)
@@ -1,4 +1,4 @@
-"ordicluster" <-
+`ordicluster` <-
     function (ord, cluster, prune=0, display="sites", w = weights(ord, display),
               ...)
 {
@@ -10,19 +10,20 @@
         stop("Dimensions do not match in 'ord' and 'cluster'")
     if (length(w) == 1) w <- rep(w, nrow(ord))
     n <- if (is.null(w)) rep(1, nrow(ord)) else w
+    noden <- numeric(nrow(ord))
     go <- ord
     for (i in 1: (nrow(mrg) - prune)) {
         a <- mrg[i,1]
         b <- mrg[i,2]
         one <- if (a < 0) ord[-a,] else go[a,]
         two <- if (b < 0) ord[-b,] else go[b,]
-        n1 <- if (a < 0) n[-a] else n[a]
-        n2 <- if (b < 0) n[-b] else n[b]
+        n1 <- if (a < 0) n[-a] else noden[a]
+        n2 <- if (b < 0) n[-b] else noden[b]
         ordiArgAbsorber(one[1], one[2], two[1], two[2], FUN = segments, ...)
         xm <- weighted.mean(c(one[1],two[1]), w=c(n1,n2))
         ym <- weighted.mean(c(one[2],two[2]), w=c(n1,n2))
         go[i,] <- c(xm,ym)
-        n[i] <- n1 + n2
+        noden[i] <- n1 + n2
     }
-    invisible(cbind(go, "w"=n))
+    invisible(cbind(go, "w"=noden))
 }



More information about the Vegan-commits mailing list