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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 20 17:08:43 CET 2013


Author: jarioksa
Date: 2013-11-20 17:08:43 +0100 (Wed, 20 Nov 2013)
New Revision: 2715

Modified:
   pkg/vegan/R/anovacca.byterm.R
Log:
reformat anovacca.byterm output to a standard term table

Modified: pkg/vegan/R/anovacca.byterm.R
===================================================================
--- pkg/vegan/R/anovacca.byterm.R	2013-11-20 11:26:37 UTC (rev 2714)
+++ pkg/vegan/R/anovacca.byterm.R	2013-11-20 16:08:43 UTC (rev 2715)
@@ -16,6 +16,7 @@
     trmlab <- attr(trms, "term.labels")
     trmlab <- trmlab[trmlab %in% attr(terms(object$terminfo),
                                       "term.labels")]
+    ntrm <- length(trmlab)
     m0 <- update(object, . ~ 1)
     mods <- list(m0)
     for(i in seq_along(trmlab)) {
@@ -23,7 +24,16 @@
         mods[[i+1]] <- update(mods[[i]], fla)
     }
     ## The result. Should be reformatted
-    anova.ccalist(mods, permutations = permutations, model = model, parallel = parallel)
+    sol <- anova.ccalist(mods, permutations = permutations,
+                         model = model, parallel = parallel)
+    out <- data.frame(c(sol[-1,3], sol[ntrm+1,1]),
+                      c(sol[-1,4], sol[ntrm+1,2]),
+                      c(sol[-1,5], NA),
+                      c(sol[-1,6], NA))
+    colnames(out) <- c("Df", "Chisq", "F", "Pr(>F)")
+    rownames(out) <- c(trmlab, "Residual")
+    class(out) <- c("anova","data.frame")
+    out
 }
 
 ## by = margin: this is not a anova.ccalist case, but we omit each



More information about the Vegan-commits mailing list