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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 13 21:47:06 CEST 2010


Author: jarioksa
Date: 2010-09-13 21:47:05 +0200 (Mon, 13 Sep 2010)
New Revision: 1301

Modified:
   pkg/vegan/R/metaMDSdist.R
   pkg/vegan/inst/ChangeLog
Log:
metaMDS is more verbose about connectivity, add a couple na.rm=TRUE

Modified: pkg/vegan/R/metaMDSdist.R
===================================================================
--- pkg/vegan/R/metaMDSdist.R	2010-09-09 08:29:24 UTC (rev 1300)
+++ pkg/vegan/R/metaMDSdist.R	2010-09-13 19:47:05 UTC (rev 1301)
@@ -36,7 +36,7 @@
         if (zerodist == "fail") 
             stop("Zero dissimilarities are not allowed")
         else if (zerodist == "add") {
-            zero <- min(dis[dis > 0])/2
+            zero <- min(dis[dis > 0], na.rm = TRUE)/2
             dis[dis <= 0] <- zero
             warning("Zero dissimilarities changed into ", zero)
         }
@@ -50,13 +50,13 @@
     if (noshare > 0 && sum(tmp <- no.shared(comm))/length(dis) > noshare) {
         if (trace) 
             cat("Using step-across dissimilarities:\n")
-        rn <- range(dis[tmp])
+        rn <- range(dis[tmp], na.rm = TRUE)
         if (rn[2]/rn[1] > 1.01)
             warning("non-constant distances between points with nothing shared\n",
                     "  stepacross may be meaningless: consider argument 'noshare=0'")
         is.na(dis) <- tmp
         dis <- stepacross(dis, trace = trace, toolong=0, ...)
-        if (length(unique(distconnected(tmp, trace = trace > 1))) > 1) 
+        if (length(unique(distconnected(tmp, trace = trace))) > 1) 
             warning("Data are disconnected, results may be meaningless")
     }
     attr(dis, "maxdis") <- maxdis

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-09-09 08:29:24 UTC (rev 1300)
+++ pkg/vegan/inst/ChangeLog	2010-09-13 19:47:05 UTC (rev 1301)
@@ -8,6 +8,9 @@
 	unbiased Simpson of a true random sample of Hurlbert (1971,
 	eq. 5). Added after several wishes to have this function.
 
+	* metaMDS: more verbose about connectivity. Use na.rm = TRUE in
+	metaMDSdist(). 
+
 	* FAQ: entry on ade4:cca name clash triggered by an invalid bug
 	report #1066 and queries in r-sig-ecology.
 	



More information about the Vegan-commits mailing list