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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun May 20 15:55:50 CEST 2012


Author: jarioksa
Date: 2012-05-20 15:55:49 +0200 (Sun, 20 May 2012)
New Revision: 2170

Modified:
   pkg/vegan/R/bioenv.default.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/bioenv.Rd
Log:
Squashed commit of the following:

commit 44e23b3fabc2c7b243432860c46be8fe94fa1885
Author: Jari Oksanen <jari.oksanen at oulu.fi>
Date:   Sun May 20 16:30:32 2012 +0300

    bioenv accepts dissimilarities as an alternative to community data

    The change was triggered by a user request by Victor L. Landeiro.
    Now it is possible to use other dissimilarities than those in vegdist.
    In this user request the desire was to use betadiver() dissimilarities.

Modified: pkg/vegan/R/bioenv.default.R
===================================================================
--- pkg/vegan/R/bioenv.default.R	2012-05-12 04:21:53 UTC (rev 2169)
+++ pkg/vegan/R/bioenv.default.R	2012-05-20 13:55:49 UTC (rev 2170)
@@ -34,7 +34,18 @@
     }
     x <- scale(env)
     best <- list()
-    comdis <- vegdist(comm, method = index)
+    if (inherits(comm, "dist")) {
+        comdis <- comm
+        index <- attr(comdis, "method")
+        if (is.null(index))
+            index <- "unspecified"
+    } else if (is.matrix(comm) && nrow(comm) == ncol(comm) &&
+             isTRUE(all.equal(comm, t(comm)))) {
+        comdis <- as.dist(comm)
+        index <- "supplied square matrix"
+    } else {
+        comdis <- vegdist(comm, method = index)
+    }
     ## Prepare for parallel processing
     if (is.null(parallel) && getRversion() >= "2.15.0")
         parallel <- get("default", envir = parallel:::.reg)

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2012-05-12 04:21:53 UTC (rev 2169)
+++ pkg/vegan/inst/ChangeLog	2012-05-20 13:55:49 UTC (rev 2170)
@@ -4,6 +4,10 @@
 
 Version 2.1-16 (opened May 11, 2012)
 
+	* bioenv: accepts now dissimilarities or a square matrix that can
+	interpred as dissimilarities instead of a community data frame.
+	This allows using other dissimilarities than those in vegdist(). 
+
 	* update.nullmodel: explicit assignment is required to update
 	the input object (nm <- update(nm, ...)).
 

Modified: pkg/vegan/man/bioenv.Rd
===================================================================
--- pkg/vegan/man/bioenv.Rd	2012-05-12 04:21:53 UTC (rev 2169)
+++ pkg/vegan/man/bioenv.Rd	2012-05-20 13:55:49 UTC (rev 2170)
@@ -19,11 +19,12 @@
 }
 
 \arguments{
-  \item{comm}{Community data frame. }
+  \item{comm}{Community data frame or a dissimilarity object or a square
+    matrix that can be interpreted as dissimilarities. }
   \item{env}{Data frame of continuous environmental variables. }
   \item{method}{The correlation method used in \code{\link{cor}}.}
-  \item{index}{The dissimilarity index used for community data in
-    \code{\link{vegdist}}. }
+  \item{index}{The dissimilarity index used for community data (\code{comm}) 
+    in \code{\link{vegdist}}. This is ignored if \code{comm} are dissimilarities.}
   \item{upto}{Maximum number of parameters in studied subsets.}
   \item{formula, data}{Model \code{\link{formula}} and data.}
   \item{trace}{Trace the advance of calculations }



More information about the Vegan-commits mailing list