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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Dec 1 13:31:25 CET 2010


Author: jarioksa
Date: 2010-12-01 13:31:25 +0100 (Wed, 01 Dec 2010)
New Revision: 1383

Modified:
   pkg/vegan/R/prc.R
   pkg/vegan/inst/ChangeLog
Log:
prc got back na.action and internal formula interface

Modified: pkg/vegan/R/prc.R
===================================================================
--- pkg/vegan/R/prc.R	2010-12-01 10:52:03 UTC (rev 1382)
+++ pkg/vegan/R/prc.R	2010-12-01 12:31:25 UTC (rev 1383)
@@ -12,7 +12,7 @@
     oldcon <- options(contrasts = c("contr.treatment", "contr.poly"))
     on.exit(options(oldcon))
     fla <- as.formula(paste("~", x, "+", z))
-    mf <- model.frame(fla, data)
+    mf <- model.frame(fla, data, na.action = na.pass)
     if (!all(sapply(mf, is.factor)))
         stop(x, " and ", z, " must be factors")
     if (any(sapply(mf, is.ordered)))
@@ -20,9 +20,9 @@
     fla.zx <- as.formula(paste("~", z, ":", x))
     fla.z <- as.formula(paste("~", z))
     # delete first (control) level from the design matrix
-    X = model.matrix(fla.zx, data)[,-c(seq_len(nlevels(time)+1))]
-    Z = model.matrix(fla.z, data)[,-1]
-    mod <- rda(response, X, Z, ...)
+    X = model.matrix(fla.zx, mf)[,-c(seq_len(nlevels(time)+1))]
+    Z = model.matrix(fla.z, mf)[,-1]
+    mod <- rda(response ~ X + Condition(Z), ...)
     mod$terminfo$xlev = list(levels(time), levels(treatment))
     names(mod$terminfo$xlev) = c(paste(z), paste(x))
     mod$call <- match.call()

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-12-01 10:52:03 UTC (rev 1382)
+++ pkg/vegan/inst/ChangeLog	2010-12-01 12:31:25 UTC (rev 1383)
@@ -4,6 +4,9 @@
 
 Version 1.18-17 (opened November 17, 2010)
 
+	* prc: got back the formula interface and with that the na.action
+	lost in r1356 (9 Nov, 2010).
+
 	* predict.procrustes: gained 'truemean' so that new points can be
 	added to the plot.procrustes() graph.
 



More information about the Vegan-commits mailing list