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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 9 08:13:25 CEST 2009


Author: jarioksa
Date: 2009-08-09 08:13:24 +0200 (Sun, 09 Aug 2009)
New Revision: 911

Modified:
   pkg/vegan/R/metaMDSdist.R
Log:
metaMDSdist returns 'dist' unchanged and hence 'metaMDSredist' may work with user supplied dissimilarities

Modified: pkg/vegan/R/metaMDSdist.R
===================================================================
--- pkg/vegan/R/metaMDSdist.R	2009-08-09 05:59:29 UTC (rev 910)
+++ pkg/vegan/R/metaMDSdist.R	2009-08-09 06:13:24 UTC (rev 911)
@@ -3,6 +3,11 @@
               trace = 1, commname, zerodist = "fail", distfun = vegdist, 
               ...) 
 {
+    ## metaMDSdist should get a raw data matrix, but if it gets a
+    ## 'dist' object return that unchanged and quit silently.
+    if (inherits(comm, "dist")  || ncol(comm) == nrow(comm) &&
+        all(comm == t(comm)))
+        return(comm)
     distname <- deparse(substitute(distfun))
     distfun <- match.fun(distfun)
     zerodist <- match.arg(zerodist, c("fail", "add", "ignore"))



More information about the Vegan-commits mailing list