[Vegan-commits] r2997 - in pkg/vegan: . R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Apr 4 09:26:57 CEST 2016
Author: jarioksa
Date: 2016-04-04 09:26:57 +0200 (Mon, 04 Apr 2016)
New Revision: 2997
Modified:
pkg/vegan/NAMESPACE
pkg/vegan/R/add1.cca.R
pkg/vegan/R/anova.cca.R
pkg/vegan/R/anova.ccalist.R
pkg/vegan/R/drop1.cca.R
pkg/vegan/R/eigenvals.R
pkg/vegan/R/ordiR2step.R
pkg/vegan/R/ordistep.R
pkg/vegan/inst/NEWS.Rd
pkg/vegan/man/cca.Rd
Log:
Merge branch 'cran-2.3' into r-forge-svn-local
Modified: pkg/vegan/NAMESPACE
===================================================================
--- pkg/vegan/NAMESPACE 2016-03-10 09:14:40 UTC (rev 2996)
+++ pkg/vegan/NAMESPACE 2016-04-04 07:26:57 UTC (rev 2997)
@@ -388,6 +388,7 @@
S3method(print, summary.clamtest)
S3method(print, summary.decorana)
S3method(print, summary.dispweight)
+S3method(print, summary.eigenvals)
S3method(print, summary.humpfit)
S3method(print, summary.isomap)
S3method(print, summary.meandist)
Modified: pkg/vegan/R/add1.cca.R
===================================================================
--- pkg/vegan/R/add1.cca.R 2016-03-10 09:14:40 UTC (rev 2996)
+++ pkg/vegan/R/add1.cca.R 2016-04-04 07:26:57 UTC (rev 2997)
@@ -4,6 +4,8 @@
{
if (inherits(object, "prc"))
stop("'step'/'add1' cannot be used for 'prc' objects")
+ if (is.null(object$terms))
+ stop("ordination model must be fitted using formula")
test <- match.arg(test)
## Default add1
out <- NextMethod("add1", object, test = "none", ...)
Modified: pkg/vegan/R/anova.cca.R
===================================================================
--- pkg/vegan/R/anova.cca.R 2016-03-10 09:14:40 UTC (rev 2996)
+++ pkg/vegan/R/anova.cca.R 2016-04-04 07:26:57 UTC (rev 2997)
@@ -38,6 +38,8 @@
## by cases
if (!is.null(by)) {
by <- match.arg(by, c("terms", "margin", "axis"))
+ if (is.null(object$terms))
+ stop("model must be fitted with formula interface")
sol <- switch(by,
"terms" = anova.ccabyterm(object,
permutations = permutations,
Modified: pkg/vegan/R/anova.ccalist.R
===================================================================
--- pkg/vegan/R/anova.ccalist.R 2016-03-10 09:14:40 UTC (rev 2996)
+++ pkg/vegan/R/anova.ccalist.R 2016-04-04 07:26:57 UTC (rev 2997)
@@ -14,17 +14,20 @@
stop("same ordination method must be used in all models")
else
method <- method[1]
- ## 2. Same response
+ ## 2. All models must be fitted with formula interface
+ if (any(sapply(object, function(x) is.null(x$terms))))
+ stop("all models must be fitted with formula interface")
+ ## 3. Same response
resp <- sapply(object, function(z) deparse(formula(z)[[2]]))
if (!all(resp == resp[1]))
stop("response must be same in all models")
- ## 3. Same no. of observations
+ ## 4. Same no. of observations
N <- sapply(object, nobs)
if (!all(N == N[1]))
stop("number of observations must be same in all models")
else
N <- N[1]
- ## 4. Terms must be nested
+ ## 5. Terms must be nested
trms <- lapply(object, function(z) labels(terms(z)))
o <- order(sapply(trms, length))
for (i in 2:nmodels)
Modified: pkg/vegan/R/drop1.cca.R
===================================================================
--- pkg/vegan/R/drop1.cca.R 2016-03-10 09:14:40 UTC (rev 2996)
+++ pkg/vegan/R/drop1.cca.R 2016-04-04 07:26:57 UTC (rev 2997)
@@ -4,6 +4,8 @@
{
if (inherits(object, "prc"))
stop("'step'/'drop1' cannot be used for 'prc' objects")
+ if (is.null(object$terms))
+ stop("ordination model must be fitted using formula")
test <- match.arg(test)
out <- NextMethod("drop1", object, test="none", ...)
cl <- class(out)
Modified: pkg/vegan/R/eigenvals.R
===================================================================
--- pkg/vegan/R/eigenvals.R 2016-03-10 09:14:40 UTC (rev 2996)
+++ pkg/vegan/R/eigenvals.R 2016-04-04 07:26:57 UTC (rev 2997)
@@ -137,6 +137,17 @@
`Proportion Explained` = round(abs(vars), 5),
`Cumulative Proportion`= round(cumsum(abs(vars)), 5))
out <- list(importance = importance)
- class(out) <- c("summary.eigenvals", "summary.prcomp")
+ class(out) <- c("summary.eigenvals")
out
}
+
+## before R svn commit 70391 we used print.summary.prcomp, but now we
+## need our own version that is similar to pre-70391 R function
+
+`print.summary.eigenvals` <-
+ function(x, digits = max(3L, getOption("digits") - 3L), ...)
+{
+ cat("Importance of components:\n")
+ print(x$importance, digits = digits, ...)
+ invisible(x)
+}
Modified: pkg/vegan/R/ordiR2step.R
===================================================================
--- pkg/vegan/R/ordiR2step.R 2016-03-10 09:14:40 UTC (rev 2996)
+++ pkg/vegan/R/ordiR2step.R 2016-04-04 07:26:57 UTC (rev 2997)
@@ -8,6 +8,8 @@
trace = TRUE, ...)
{
direction <- match.arg(direction)
+ if (is.null(object$terms))
+ stop("ordination model must be fitted using formula")
if (missing(scope))
stop("needs scope")
## Works only for rda(): cca() does not have (yet) R2.adjusted
Modified: pkg/vegan/R/ordistep.R
===================================================================
--- pkg/vegan/R/ordistep.R 2016-03-10 09:14:40 UTC (rev 2996)
+++ pkg/vegan/R/ordistep.R 2016-04-04 07:26:57 UTC (rev 2997)
@@ -5,6 +5,8 @@
{
if (!inherits(object, "cca"))
stop("function can be only used with 'cca' and related objects")
+ if (is.null(object$terms))
+ stop("ordination model must be fitted using formula")
## handling 'direction' and 'scope' directly copied from
## stats::step()
md <- missing(direction)
Modified: pkg/vegan/inst/NEWS.Rd
===================================================================
--- pkg/vegan/inst/NEWS.Rd 2016-03-10 09:14:40 UTC (rev 2996)
+++ pkg/vegan/inst/NEWS.Rd 2016-04-04 07:26:57 UTC (rev 2997)
@@ -2,6 +2,22 @@
\title{vegan News}
\encoding{UTF-8}
+\section{Changes in version 2.3-5}{
+ \subsection{BUG FIXES}{
+ \itemize{
+
+ \item \code{eigenvals} fails with \code{prcomp} results in
+ \R-devel. The next version of \code{prcomp} will have an
+ argument to limit the number of eigenvalues shown
+ (\code{rank.}), and this breaks \code{eigenvals} in \pkg{vegan}.
+
+ \item \code{calibrate} failed for \code{cca} and friends if
+ \code{rank} was given.
+
+ } % itemise
+ } % bug fixes
+} % v2.3-5
+
\section{Changes in version 2.3-4}{
\subsection{BUG FIXES}{
Modified: pkg/vegan/man/cca.Rd
===================================================================
--- pkg/vegan/man/cca.Rd 2016-03-10 09:14:40 UTC (rev 2996)
+++ pkg/vegan/man/cca.Rd 2016-04-04 07:26:57 UTC (rev 2997)
@@ -34,7 +34,9 @@
of the model formula.}
\item{X}{ Community data matrix. }
\item{Y}{ Constraining matrix, typically of environmental variables.
- Can be missing. }
+ Can be missing. It is better to use \code{formula} instead of this
+ argument, and some further analyses only work when \code{formula}
+ was used.}
\item{Z}{ Conditioning matrix, the effect of which is removed
(`partialled out') before next step. Can be missing.}
\item{scale}{Scale species to unit variance (like correlations).}
@@ -70,10 +72,13 @@
algorithm of \pkg{vegan}. The algorithm of CCA is similar, but
involves standardization by row and column weights.
- The functions can be called either with matrix-like entries for community
- data and constraints, or with formula interface. In general, the
- formula interface is preferred, because it allows a better control of
- the model and allows factor constraints.
+ The functions can be called either with matrix-like entries for
+ community data and constraints, or with formula interface. In
+ general, the formula interface is preferred, because it allows a
+ better control of the model and allows factor constraints. Some
+ analyses of ordination results are only possible if model was fitted
+ with formula (e.g., most cases of \code{\link{anova.cca}}, automatic
+ model building).
In the following sections, \code{X}, \code{Y} and \code{Z}, although
referred to as matrices, are more commonly data frames.
More information about the Vegan-commits
mailing list