[Vegan-commits] r523 - in pkg: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Oct 10 10:54:54 CEST 2008


Author: jarioksa
Date: 2008-10-10 10:54:54 +0200 (Fri, 10 Oct 2008)
New Revision: 523

Modified:
   pkg/DESCRIPTION
   pkg/R/anosim.R
   pkg/inst/ChangeLog
   pkg/man/anosim.Rd
Log:
anosim: API similar to mrpp

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2008-10-07 14:13:51 UTC (rev 522)
+++ pkg/DESCRIPTION	2008-10-10 08:54:54 UTC (rev 523)
@@ -1,7 +1,7 @@
 Package: vegan
 Title: Community Ecology Package
-Version: 1.16-1
-Date: October 5, 2008
+Version: 1.16-2
+Date: October 10, 2008
 Author: Jari Oksanen, Roeland Kindt, Pierre Legendre, Bob O'Hara, Gavin L. Simpson, 
    Peter Solymos, M. Henry H. Stevens, Helene Wagner  
 Maintainer: Jari Oksanen <jari.oksanen at oulu.fi>

Modified: pkg/R/anosim.R
===================================================================
--- pkg/R/anosim.R	2008-10-07 14:13:51 UTC (rev 522)
+++ pkg/R/anosim.R	2008-10-10 08:54:54 UTC (rev 523)
@@ -1,7 +1,15 @@
 "anosim" <-
-    function (dis, grouping, permutations = 1000, strata) 
+    function (dat, grouping, permutations = 1000,
+              distance = "bray", strata) 
 {
-    x <- as.dist(dis)
+    if (inherits(dat, "dist")) 
+        x <- dat
+    else if (is.matrix(dat) && nrow(dat) == ncol(dat) && all(dat[lower.tri(dat)] == 
+        t(dat)[lower.tri(dat)])) {
+        x <- dat
+        attr(x, "method") <- "user supplied square matrix"
+    }
+    else x <- vegdist(dat, method = distance)
     sol <- c(call = match.call())
     grouping <- as.factor(grouping)
     matched <- function(irow, icol, grouping) {
@@ -36,7 +44,7 @@
     sol$statistic <- as.numeric(statistic)
     sol$class.vec <- cl.vec
     sol$dis.rank <- x.rank
-    sol$dissimilarity <- attr(dis, "method") 
+    sol$dissimilarity <- attr(x, "method") 
     if (!missing(strata)) {
         sol$strata <- deparse(substitute(strata))
         sol$stratum.values <- strata

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2008-10-07 14:13:51 UTC (rev 522)
+++ pkg/inst/ChangeLog	2008-10-10 08:54:54 UTC (rev 523)
@@ -2,12 +2,18 @@
 
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
-Version 1.16-1 (opened September 30, 2008)
+Version 1.16-2 (opened October 10, 2008)
 
-    * dispindmorisita: function to calculate Morisita's index of
-    dispersion, and its standardized version. Uses the correct
-    way of standardizing, see Note section in help.
+	* anosim: API and documentation made similar to mrpp to combine
+	their documentation. Now anosim can take data frame input and find
+	the dissimilarities internally.
+	
+Version 1.16-1 (closed October 10, 2008)
 
+	* dispindmorisita: function to calculate Morisita's index of
+	dispersion, and its standardized version. Uses the correct way of
+	standardizing, see Note section in help.
+
 	* radfit: Should work with empty sites (no species) or when the
 	number of species is less or equal the number of parameters
 	estimated (like may happen in sweeping analysis of data frames or

Modified: pkg/man/anosim.Rd
===================================================================
--- pkg/man/anosim.Rd	2008-10-07 14:13:51 UTC (rev 522)
+++ pkg/man/anosim.Rd	2008-10-10 08:54:54 UTC (rev 523)
@@ -11,14 +11,20 @@
   of sampling units.
 }
 \usage{
-anosim(dis, grouping, permutations=1000, strata)
+anosim(dat, grouping, permutations=1000, distance = "bray", strata)
 }
 
 \arguments{
-  \item{dis}{Dissimilarity matrix.}
+  \item{dat}{Data matrix or data frame in which rows are samples and
+    columns are response variable(s), or a dissimilarity object or a
+    symmetric square matrix of dissimilarities.}
   \item{grouping}{Factor for grouping observations.}
   \item{permutations}{Number of permutation to assess the significance
     of the ANOSIM statistic. }
+  \item{distance}{Choice of distance metric that measures the
+    dissimilarity between two observations . See \code{\link{vegdist}} for
+    options.  This will be used if \code{dat} was not a dissimilarity
+    structure of a symmetric square matrix.}  
   \item{strata}{An integer vector or factor specifying the strata for
     permutation. If supplied, observations are permuted only within the
     specified strata.}



More information about the Vegan-commits mailing list