[Vegan-commits] r1678 - in pkg/vegan: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jul 5 13:28:24 CEST 2011
Author: jarioksa
Date: 2011-07-05 13:28:23 +0200 (Tue, 05 Jul 2011)
New Revision: 1678
Modified:
pkg/vegan/R/betadiver.R
pkg/vegan/inst/ChangeLog
pkg/vegan/man/betadiver.Rd
Log:
'index' was renamed to 'method' for dist() compatibility of betadiver()
Modified: pkg/vegan/R/betadiver.R
===================================================================
--- pkg/vegan/R/betadiver.R 2011-07-05 08:22:30 UTC (rev 1677)
+++ pkg/vegan/R/betadiver.R 2011-07-05 11:28:23 UTC (rev 1678)
@@ -1,6 +1,14 @@
`betadiver` <-
- function(x, index = NA, order = FALSE, help = FALSE, ...)
+ function(x, method = NA, order = FALSE, help = FALSE, ...)
{
+ ## 'index' was renamed to 'method' in vegan 1.90-1 for dist()
+ ## compatibility. Below we implement backward compatibility (with
+ ## warning) for 'index'.
+ dots <- match.call(expand.dots = FALSE)$...
+ if (any(k <- pmatch(names(dots), "index", nomatch = FALSE))) {
+ warning("argument 'index' deprecated: use 'method'")
+ method <- dots[[which(k==1)]]
+ }
beta <- list("w"="(b+c)/(2*a+b+c)", "-1"="(b+c)/(2*a+b+c)", "c"="(b+c)/2",
"wb"="b+c", "r"="2*b*c/((a+b+c)^2-2*b*c)",
"I"="log(2*a+b+c)-2*a*log(2)/(2*a+b+c)-((a+b)*log(a+b)+(a+c)*log(a+c))/(2*a+b+c)",
@@ -33,14 +41,14 @@
N <- length(S)
b <- as.dist(matrix(rep(S, N), nrow=N)) - a
c <- as.dist(matrix(rep(S, each=N), nrow=N)) - a
- if (is.na(index) || is.null(index) || is.logical(index) && !index) {
+ if (is.na(method) || is.null(method) || is.logical(method) && !method) {
out <- list(a = a, b = b, c = c)
class(out) <- "betadiver"
return(out)
}
- out <- eval(parse(text=beta[[index]]))
+ out <- eval(parse(text=beta[[method]]))
out <- as.dist(out)
- attr(out, "method") <- paste("beta", names(beta[index]), sep=".")
+ attr(out, "method") <- paste("beta", names(beta[method]), sep=".")
attr(out, "call") <- match.call()
out
}
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2011-07-05 08:22:30 UTC (rev 1677)
+++ pkg/vegan/inst/ChangeLog 2011-07-05 11:28:23 UTC (rev 1678)
@@ -4,6 +4,10 @@
Version 1.90-1 (opened July 3, 2011)
+ * betadiver: argument 'index' was renamed to 'method' for
+ compatibility with dist() objects. Argument 'index' is
+ still recognized with a warning.
+
* metaMDS: Documentation and interface adapted to monoMDS().
Argument 'noshare' defaults to FALSE with monoMDS(), since tie
breaking seem to handle tied maximum dissimilarities even better
Modified: pkg/vegan/man/betadiver.Rd
===================================================================
--- pkg/vegan/man/betadiver.Rd 2011-07-05 08:22:30 UTC (rev 1677)
+++ pkg/vegan/man/betadiver.Rd 2011-07-05 11:28:23 UTC (rev 1678)
@@ -13,7 +13,7 @@
}
\usage{
-betadiver(x, index = NA, order = FALSE, help = FALSE, ...)
+betadiver(x, method = NA, order = FALSE, help = FALSE, ...)
\method{plot}{betadiver}(x, ...)
\method{scores}{betadiver}(x, triangular = TRUE, ...)
}
@@ -21,7 +21,7 @@
\arguments{
\item{x}{Community data matrix, or the \code{betadiver} result for
\code{plot} and \code{scores} functions. }
- \item{index}{The index of beta diversity as defined in Koleff et al.
+ \item{method}{The index of beta diversity as defined in Koleff et al.
(2003), Table 1. You can use either the subscript of \eqn{\beta} or
the number of the index. See argument \code{help} below. }
\item{order}{Order sites by increasing number of species. This will
@@ -67,7 +67,7 @@
alternatives is much lower than 24 formally provided. The formulations
used in functions differ occasionally from those in Koleff et
al. (2003), but they are still mathematically equivalent. With
- \code{index = NA}, no index is calculated, but instead an object of
+ \code{method = NA}, no index is calculated, but instead an object of
class \code{betadiver} is returned. This is a list of elements
\code{a}, \code{b} and \code{c}. Function \code{plot} can be used to
display the proportions of these elements in triangular plot as
@@ -77,9 +77,9 @@
object.
}
-\value{ With \code{index = NA}, the function returns an object of
+\value{ With \code{method = NA}, the function returns an object of
class \code{"betadisper"} with elements \code{a}, \code{b}, and
- \code{c}. If \code{index} is specified, the function returns a
+ \code{c}. If \code{method} is specified, the function returns a
\code{"dist"} object which can be used in any function analysing
dissimilarities. For beta diversity, particularly useful functions
are \code{\link{betadisper}} to study the betadiversity in groups,
@@ -92,6 +92,11 @@
are two such similarity indices.
}
+\note{The argument \code{method} was called \code{index} in older
+ versions of the function (upto \pkg{vegan} version
+ 1.17-11). Argument \code{index} is deprecated, but still recognized
+ with a warning. }
+
\references{
Koleff, P., Gaston, K.J. and Lennon, J.J. (2003) Measuring beta
diversity for presence-absence data. \emph{Journal of Animal Ecology}
More information about the Vegan-commits
mailing list