[Vegan-commits] r1045 - pkg/vegan/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Oct 14 16:16:38 CEST 2009


Author: jarioksa
Date: 2009-10-14 16:16:37 +0200 (Wed, 14 Oct 2009)
New Revision: 1045

Modified:
   pkg/vegan/R/anova.ccabyterm.R
Log:
anova.ccabyterm works now if the model was defined as with(data, rda(...))

Modified: pkg/vegan/R/anova.ccabyterm.R
===================================================================
--- pkg/vegan/R/anova.ccabyterm.R	2009-10-14 13:46:05 UTC (rev 1044)
+++ pkg/vegan/R/anova.ccabyterm.R	2009-10-14 14:16:37 UTC (rev 1045)
@@ -25,12 +25,14 @@
     pchi[ntrm, ] <- sim$num
     df[ntrm:(ntrm + 1)] <- sim$df
     chi[ntrm:(ntrm + 1)] <- sim$chi
+    modelframe <- model.frame(object)
+    environment(object$terms) <- environment()
     for (.ITRM in ntrm:2) {
         if (ntrm < 2) 
             break
         assign(".Random.seed", sim$Random.seed, envir = .GlobalEnv)
         fla <- as.formula(paste(" . ~ . -", trmlab[.ITRM]))
-        object <- update(object, fla)
+        object <- update(object, fla, data = modelframe)
         ## Change in data set due to missing values?
         if (length(object$residuals) != n0)
             stop("number of rows has changed: remove missing values?")



More information about the Vegan-commits mailing list