[Vegan-commits] r1455 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jan 14 14:34:16 CET 2011
Author: jarioksa
Date: 2011-01-14 14:34:15 +0100 (Fri, 14 Jan 2011)
New Revision: 1455
Modified:
pkg/vegan/R/anova.ccabyaxis.R
pkg/vegan/R/anova.ccabyterm.R
pkg/vegan/inst/ChangeLog
Log:
fix most open issues in anova.cca(..., by = "ax") and anova.cca(..., by = "term")
Modified: pkg/vegan/R/anova.ccabyaxis.R
===================================================================
--- pkg/vegan/R/anova.ccabyaxis.R 2011-01-13 07:41:37 UTC (rev 1454)
+++ pkg/vegan/R/anova.ccabyaxis.R 2011-01-14 13:34:15 UTC (rev 1455)
@@ -7,7 +7,7 @@
stop("Needs a constrained ordination")
if (is.null(object$terms))
stop("Analysis is only possible for models fitted using formula")
- lc <- object$CCA$u
+ lc<- as.data.frame(object$CCA$u)
## Handle missing values in scores, both "omit" and "exclude" to
## match dims with data.
if (!is.null(object$na.action)) {
@@ -21,8 +21,10 @@
Pval <- rep(NA, rnk+1)
out <- data.frame(df, chi, Fval, nperm, Pval)
environment(object$terms) <- environment()
- fla <- update(formula(object), . ~ lc[,1] + Condition(lc[,-1]))
- sol <- anova(update(object, fla), ...)
+ fla <- paste(". ~ ", axnam[1], "+ Condition(",
+ paste(axnam[-1], collapse="+"),")")
+ fla <- update(formula(object), fla)
+ sol <- anova(update(object, fla, data=lc), ...)
out[c(1, rnk + 1), ] <- sol
seed <- attr(sol, "Random.seed")
attr(out, "names") <- attr(sol, "names")
@@ -33,8 +35,10 @@
bigperm <- out$N.Perm[1]
if (rnk > 1) {
for (.ITRM in 2:rnk) {
- fla <- update(formula(object), .~ lc[, .ITRM] + Condition(lc[,-(.ITRM)]) )
- sol <- update(object, fla)
+ fla <- paste(".~", axnam[.ITRM], "+Condition(",
+ paste(axnam[-(.ITRM)], collapse="+"),")")
+ fla <- update(formula(object), fla)
+ sol <- update(object, fla, data = lc)
assign(".Random.seed", seed, envir = .GlobalEnv)
out[.ITRM, ] <- as.matrix(anova(sol, ...))[1,
]
Modified: pkg/vegan/R/anova.ccabyterm.R
===================================================================
--- pkg/vegan/R/anova.ccabyterm.R 2011-01-13 07:41:37 UTC (rev 1454)
+++ pkg/vegan/R/anova.ccabyterm.R 2011-01-14 13:34:15 UTC (rev 1455)
@@ -25,7 +25,7 @@
pchi[ntrm, ] <- sim$num
df[ntrm:(ntrm + 1)] <- sim$df
chi[ntrm:(ntrm + 1)] <- sim$chi
- modelframe <- model.frame(object)
+ modelframe <- ordiGetData(object$call, NULL)
environment(object$terms) <- environment()
for (.ITRM in ntrm:2) {
if (ntrm < 2)
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2011-01-13 07:41:37 UTC (rev 1454)
+++ pkg/vegan/inst/ChangeLog 2011-01-14 13:34:15 UTC (rev 1455)
@@ -20,6 +20,13 @@
scale of input dissimilarities. The function uses only the real
axes, and imaginary dimensions are ignored.
+ * anova.cca: by = "term" and by = "axis" work now both with the
+ data= statement and with variables in the GlobalEnv both in
+ cca/rda and in capscale. A failing case is still anova(..., by =
+ "axis", subset=...) because subset is applied to the constraints,
+ but not to the response. Moreover, it seems that 'subset' is not
+ implemented for capscale().
+
Version 1.18-20 (closed January 9, 2011)
* base of vegan release 1.17-6 (released on Jan 10, 2011).
More information about the Vegan-commits
mailing list