[Vegan-commits] r964 - in branches/1.15: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Aug 27 15:30:54 CEST 2009
Author: jarioksa
Date: 2009-08-27 15:30:53 +0200 (Thu, 27 Aug 2009)
New Revision: 964
Modified:
branches/1.15/R/anosim.R
branches/1.15/inst/ChangeLog
branches/1.15/inst/NEWS
branches/1.15/man/anosim.Rd
Log:
merge anosim to branches/1.15
Modified: branches/1.15/R/anosim.R
===================================================================
--- branches/1.15/R/anosim.R 2009-08-27 13:28:52 UTC (rev 963)
+++ branches/1.15/R/anosim.R 2009-08-27 13:30:53 UTC (rev 964)
@@ -1,7 +1,15 @@
"anosim" <-
- function (dis, grouping, permutations = 999, strata)
+ function (dat, grouping, permutations = 999,
+ 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: branches/1.15/inst/ChangeLog
===================================================================
--- branches/1.15/inst/ChangeLog 2009-08-27 13:28:52 UTC (rev 963)
+++ branches/1.15/inst/ChangeLog 2009-08-27 13:30:53 UTC (rev 964)
@@ -59,6 +59,8 @@
column labels.
* merged r779: formatting fixes in mrpp.Rd.
+
+ * merged changes to anosim (rev 523, 839, 963).
Version 1.15-3 (released June 17, 2009)
Modified: branches/1.15/inst/NEWS
===================================================================
--- branches/1.15/inst/NEWS 2009-08-27 13:28:52 UTC (rev 963)
+++ branches/1.15/inst/NEWS 2009-08-27 13:30:53 UTC (rev 964)
@@ -5,8 +5,12 @@
CHANGES IN 1.15-4
- - Changed package dependency: vegan does not depend on 'ellipse'.
+ - Changed package dependence: vegan does not depend on 'ellipse'.
+ - anosim: user interface identical to 'mrpp'. Most importantly,
+ accepts now data matrix and finds dissimilarities within the
+ function instead of accepting only dissimilarities.
+
- betadisper: fix removing zero eigenvalues with non-Euclidean
distances. This may change the results slightly, but in most
cases the effects are minor or none.
Modified: branches/1.15/man/anosim.Rd
===================================================================
--- branches/1.15/man/anosim.Rd 2009-08-27 13:28:52 UTC (rev 963)
+++ branches/1.15/man/anosim.Rd 2009-08-27 13:30:53 UTC (rev 964)
@@ -11,14 +11,20 @@
of sampling units.
}
\usage{
-anosim(dis, grouping, permutations=999, strata)
+anosim(dat, grouping, permutations = 999, 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 or 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