[Vegan-commits] r1456 - in pkg/vegan: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 14 20:56:19 CET 2011


Author: jarioksa
Date: 2011-01-14 20:56:17 +0100 (Fri, 14 Jan 2011)
New Revision: 1456

Modified:
   pkg/vegan/R/anova.ccabyaxis.R
   pkg/vegan/R/cca.formula.R
   pkg/vegan/R/ordiParseFormula.R
   pkg/vegan/R/rda.formula.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/cca.object.Rd
Log:
anova.cca(..., by = "axis", subset=...) works for cca/rda

Modified: pkg/vegan/R/anova.ccabyaxis.R
===================================================================
--- pkg/vegan/R/anova.ccabyaxis.R	2011-01-14 13:34:15 UTC (rev 1455)
+++ pkg/vegan/R/anova.ccabyaxis.R	2011-01-14 19:56:17 UTC (rev 1456)
@@ -7,7 +7,16 @@
         stop("Needs a constrained ordination")
     if (is.null(object$terms)) 
         stop("Analysis is only possible for models fitted using formula")
-    lc<- as.data.frame(object$CCA$u)
+    ## pad with NA rows if there is a subset
+    if (!is.null(object$subset)) {
+        lc <- matrix(NA, nrow=length(object$subset),
+                     ncol = ncol(object$CCA$u))
+        lc[object$subset,]  <- object$CCA$u
+        object$call$subset <- object$subset
+    } else {
+        lc <- object$CCA$u
+    }
+    lc <- as.data.frame(lc)
     ## Handle missing values in scores, both "omit" and "exclude" to
     ## match dims with data.
     if (!is.null(object$na.action)) {

Modified: pkg/vegan/R/cca.formula.R
===================================================================
--- pkg/vegan/R/cca.formula.R	2011-01-14 13:34:15 UTC (rev 1455)
+++ pkg/vegan/R/cca.formula.R	2011-01-14 19:56:17 UTC (rev 1456)
@@ -24,6 +24,7 @@
     }
     sol$terms <- d$terms
     sol$terminfo <- ordiTerminfo(d, d$modelframe)
+    sol$subset <- d$subset
     sol$na.action <- d$na.action
     sol$call <- match.call()
     sol$call[[1]] <- as.name("cca")

Modified: pkg/vegan/R/ordiParseFormula.R
===================================================================
--- pkg/vegan/R/ordiParseFormula.R	2011-01-14 13:34:15 UTC (rev 1455)
+++ pkg/vegan/R/ordiParseFormula.R	2011-01-14 19:56:17 UTC (rev 1456)
@@ -98,5 +98,5 @@
     }
     list(X = X, Y = Y, Z = Z, terms = terms(fla, width.cutoff = 500), 
          terms.expand = terms(flapart, width.cutoff = 500), modelframe = mf,
-         na.action = nas, excluded = excluded)
+         subset = subset, na.action = nas, excluded = excluded)
 }

Modified: pkg/vegan/R/rda.formula.R
===================================================================
--- pkg/vegan/R/rda.formula.R	2011-01-14 13:34:15 UTC (rev 1455)
+++ pkg/vegan/R/rda.formula.R	2011-01-14 19:56:17 UTC (rev 1456)
@@ -23,6 +23,7 @@
     }
     sol$terms <- d$terms
     sol$terminfo <- ordiTerminfo(d, d$modelframe)
+    sol$subset <- d$subset
     sol$na.action <- d$na.action
     sol$call <- match.call()
     sol$call[[1]] <- as.name("rda")

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-01-14 13:34:15 UTC (rev 1455)
+++ pkg/vegan/inst/ChangeLog	2011-01-14 19:56:17 UTC (rev 1456)
@@ -21,12 +21,13 @@
 	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(). 
+	data= statement and with variables in the GlobalEnv and subset=
+	both in cca/rda. It seems that 'subset' is not implemented for
+	capscale(), but otherwise models work.
 
+	* cca/rda: added item 'subset' that is the subset argument
+	evaluated to a logical vector.
+
 Version 1.18-20 (closed January 9, 2011)
 
 	* base of vegan release 1.17-6 (released on Jan 10, 2011).

Modified: pkg/vegan/man/cca.object.Rd
===================================================================
--- pkg/vegan/man/cca.object.Rd	2011-01-14 13:34:15 UTC (rev 1455)
+++ pkg/vegan/man/cca.object.Rd	2011-01-14 19:56:17 UTC (rev 1456)
@@ -126,11 +126,13 @@
   }
 }
 
-\section{NA Action}{
-  If the constraints had missing values, and \code{\link{na.action}}
+\section{NA Action and Subset}{
+  If the constraints had missing values or subsets, and \code{\link{na.action}}
   was set to  \code{\link{na.exclude}} or \code{\link{na.omit}}, the
   result will have some extra items:
   \describe{
+    \item{\code{subset}}{subset evaluated as a logical vector
+      (\code{TRUE} for included cases).}
     \item{\code{na.action}}{The object returned by
     \code{\link{na.action}} which is a named vector of indices of
     removed items. The class of the vector is either \code{"omit"} or



More information about the Vegan-commits mailing list