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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 19 09:21:24 CET 2015


Author: jarioksa
Date: 2015-11-19 09:21:24 +0100 (Thu, 19 Nov 2015)
New Revision: 2978

Modified:
   pkg/vegan/DESCRIPTION
   pkg/vegan/R/adonis.R
   pkg/vegan/R/capscale.R
   pkg/vegan/R/mso.R
   pkg/vegan/inst/NEWS.Rd
   pkg/vegan/man/clamtest.Rd
   pkg/vegan/man/mso.Rd
Log:
Merge branch 'cran-2.3' into r-forge-svn-local

Modified: pkg/vegan/DESCRIPTION
===================================================================
--- pkg/vegan/DESCRIPTION	2015-11-13 12:07:00 UTC (rev 2977)
+++ pkg/vegan/DESCRIPTION	2015-11-19 08:21:24 UTC (rev 2978)
@@ -1,7 +1,7 @@
 Package: vegan
 Title: Community Ecology Package
 Version: 2.3-2
-Date: 2015-09-25
+Date: 2015-11-19
 Author: Jari Oksanen, F. Guillaume Blanchet, Roeland Kindt, Pierre Legendre, 
    Peter R. Minchin, R. B. O'Hara, Gavin L. Simpson, Peter Solymos, 
    M. Henry H. Stevens, Helene Wagner  

Modified: pkg/vegan/R/adonis.R
===================================================================
--- pkg/vegan/R/adonis.R	2015-11-13 12:07:00 UTC (rev 2977)
+++ pkg/vegan/R/adonis.R	2015-11-19 08:21:24 UTC (rev 2978)
@@ -38,8 +38,11 @@
         if (any(lhs < -TOL))
             stop("dissimilarities must be non-negative")
         dmat <- as.matrix(lhs^2)
-    }
-    else {
+    } else if ((is.matrix(lhs) || is.data.frame(lhs)) &&
+               isSymmetric(unname(as.matrix(lhs)))) {
+        dmat <- as.matrix(lhs^2)
+        lhs <- as.dist(lhs) # crazy: need not to calculate beta.sites
+    } else {
         dist.lhs <- as.matrix(vegdist(lhs, method=method, ...))
         dmat <- dist.lhs^2
     }

Modified: pkg/vegan/R/capscale.R
===================================================================
--- pkg/vegan/R/capscale.R	2015-11-13 12:07:00 UTC (rev 2977)
+++ pkg/vegan/R/capscale.R	2015-11-19 08:21:24 UTC (rev 2978)
@@ -18,6 +18,10 @@
     ## mysteriously at this point.
     X <- eval(formula[[2]], envir=environment(formula),
               enclos = globalenv())
+    ## see if user supplied dissimilarities as a matrix
+    if ((is.matrix(X) || is.data.frame(X)) &&
+        isSymmetric(unname(as.matrix(X))))
+        X <- as.dist(X)
     if (!inherits(X, "dist")) {
         comm <- X
         dfun <- match.fun(dfun)

Modified: pkg/vegan/R/mso.R
===================================================================
--- pkg/vegan/R/mso.R	2015-11-13 12:07:00 UTC (rev 2977)
+++ pkg/vegan/R/mso.R	2015-11-19 08:21:24 UTC (rev 2978)
@@ -12,7 +12,14 @@
     N <- nrow(object$CA$Xbar)
     if (inherits(object, "rda")) 
         N <- 1
-    Dist <- dist(xy)
+    ## we expect xy are coordinates and calculate distances, but a
+    ## swift user may have supplied distances, and we use them.
+    ## However, we won't test for distances in square matrices, but
+    ## treat that as a user mistake and let it go.
+    if (inherits(xy, "dist"))
+        Dist <- xy
+    else
+        Dist <- dist(xy)
     object$grain <- grain
     if (round.up) 
         H <- ceiling(Dist/grain) * grain

Modified: pkg/vegan/inst/NEWS.Rd
===================================================================
--- pkg/vegan/inst/NEWS.Rd	2015-11-13 12:07:00 UTC (rev 2977)
+++ pkg/vegan/inst/NEWS.Rd	2015-11-19 08:21:24 UTC (rev 2978)
@@ -7,7 +7,8 @@
   \subsection{BUG FIXES}{
     \itemize{
 
-      \item Display of gridded permutation results failed.
+      \item Printing details of a gridded permutation design would fail
+      when the grid was at the within-plot level.
 
       \item \code{ordicluster} joined the branches at wrong coordinates
       in some cases.
@@ -22,6 +23,17 @@
   \subsection{NEW FEATURES}{
     \itemize{
 
+      \item \code{adonis} and \code{capscale} functions recognize
+      symmetric square matrices as dissimilarities. Formerly
+      dissimilarities had to be given as \code{"dist"} objects such as
+      produced by \code{dist} or \code{vegdist} functions, and data
+      frames and matrices were regarded as observations x variables
+      data which could confuse users (e.g., issue
+      \href{https://github.com/vegandevs/vegan/issues/147}{#147}).
+
+      \item \code{mso} accepts \code{"dist"} objects for the distances
+      among locations as an alternative to coordinates of locations.
+
       \item \code{text}, \code{points} and \code{lines} functions for
       \code{procrustes} analysis gained new argument \code{truemean}
       which allows adding \code{procrustes} items to the plots of

Modified: pkg/vegan/man/clamtest.Rd
===================================================================
--- pkg/vegan/man/clamtest.Rd	2015-11-13 12:07:00 UTC (rev 2977)
+++ pkg/vegan/man/clamtest.Rd	2015-11-19 08:21:24 UTC (rev 2978)
@@ -114,7 +114,7 @@
 }
 \note{
 The code was tested against standalone CLAM software provided
-on the website of Anne Chao (\url{http://chao.stat.nthu.edu.tw/softwarece.html});
+on the website of Anne Chao (\url{http://chao.stat.nthu.edu.tw/wordpress/});
 minor inconsistencies were found, especially for finding the
 threshold for 'too rare' species.
 These inconsistencies are probably due to numerical differences between the

Modified: pkg/vegan/man/mso.Rd
===================================================================
--- pkg/vegan/man/mso.Rd	2015-11-13 12:07:00 UTC (rev 2977)
+++ pkg/vegan/man/mso.Rd	2015-11-19 08:21:24 UTC (rev 2978)
@@ -18,12 +18,13 @@
 }
 \arguments{
   \item{object.cca}{ An object of class cca, created by the \code{\link{cca}} or
-    \code{\link{rda}} function.} 
-  \item{object.xy}{ A vector, matrix or data frame with the spatial
-    coordinates of the data represented by object.cca. Must have the
-    same number of rows as \code{object.cca$CA$Xbar} (see
-    \code{\link{cca.object}}). } 
-  \item{grain}{ Interval size for distance classes.}
+    \code{\link{rda}} function.}
+   \item{object.xy}{ A vector, matrix or data frame with the spatial
+    coordinates of the data represented by \code{object.cca}. The
+    number of rows must match the number of observations (as given by
+    \code{nobs}) in \code{cca.object}. Alternatively, interpoint
+    distances can be supplied as a \code{\link{dist}} object. }
+   \item{grain}{ Interval size for distance classes.}
   \item{round.up}{ Determines the choice of breaks. If false, distances
     are rounded to the nearest multiple of grain. If true, distances are
     rounded to the upper multiple of grain.} 



More information about the Vegan-commits mailing list