[Vegan-commits] r1044 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Oct 14 15:46:05 CEST 2009
Author: jarioksa
Date: 2009-10-14 15:46:05 +0200 (Wed, 14 Oct 2009)
New Revision: 1044
Modified:
pkg/vegan/R/anova.ccabyaxis.R
pkg/vegan/inst/ChangeLog
Log:
anova.ccabyaxis failed if fitted model had no data= statement
Modified: pkg/vegan/R/anova.ccabyaxis.R
===================================================================
--- pkg/vegan/R/anova.ccabyaxis.R 2009-10-14 07:16:23 UTC (rev 1043)
+++ pkg/vegan/R/anova.ccabyaxis.R 2009-10-14 13:46:05 UTC (rev 1044)
@@ -8,11 +8,15 @@
if (is.null(object$terms))
stop("Analysis is only possible for models fitted using formula")
lc <- object$CCA$u
+ mf <- model.frame(object)
## Handle missing values in scores, both "omit" and "exclude" to
## match dims with data.
- if (!is.null(object$na.action))
+ if (!is.null(object$na.action)) {
lc <- stats:::napredict.exclude(object$na.action, lc)
- newdata <- cbind(lc, eval(as.list(object$call)$data))
+ mf <- lapply(mf, function(x) stats:::napredict.exclude(object$na.action, x))
+ mf <- as.data.frame(mf)
+ }
+ newdata <- cbind(lc, mf)
axnam <- colnames(lc)
df <- c(rep(1, rnk), object$CA$rank)
chi <- c(object$CCA$eig, Residual = object$CA$tot.chi)
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2009-10-14 07:16:23 UTC (rev 1043)
+++ pkg/vegan/inst/ChangeLog 2009-10-14 13:46:05 UTC (rev 1044)
@@ -4,11 +4,12 @@
Version 1.16-31 (opened October 3, 2009)
- * constraind ordination (cca, rda, capscale) could not handle all
+ * constrained ordination (cca, rda, capscale) could not handle all
anova(.., by= "something") cases when the data were not in
- data.frame but in working environment or attach'ed. Function
- anova.ccabyaxis still fails, and all fail if the data was defined
- using with().
+ data.frame but in working environment or defined using
+ with(data,...). Still failing: with(data, anova(..., by = "t"))
+ and attach'ed data frames which were detach'ed during anova (but
+ these work if attach'ed again).
* envfit: could drop data frame to a vector with na.action (broken
in 1.16-28).
More information about the Vegan-commits
mailing list