[Vegan-commits] r312 - in pkg: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Apr 10 18:25:42 CEST 2008
Author: gsimpson
Date: 2008-04-10 18:25:42 +0200 (Thu, 10 Apr 2008)
New Revision: 312
Modified:
pkg/R/adonis.R
pkg/inst/ChangeLog
Log:
adonis was not dropping empty factor levels
Modified: pkg/R/adonis.R
===================================================================
--- pkg/R/adonis.R 2008-04-10 12:47:25 UTC (rev 311)
+++ pkg/R/adonis.R 2008-04-10 16:25:42 UTC (rev 312)
@@ -10,7 +10,7 @@
lhs <- formula[[2]]
lhs <- eval(lhs, data, parent.frame()) # to force evaluation
formula[[2]] <- NULL # to remove the lhs
- rhs.frame <- model.frame(formula, data) # to get the data frame of rhs
+ rhs.frame <- model.frame(formula, data, drop.unused.levels = TRUE) # to get the data frame of rhs
op.c <- options()$contrasts
options( contrasts=c(contr.unordered, contr.ordered) )
rhs <- model.matrix(formula, rhs.frame) # and finally the model.matrix
Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog 2008-04-10 12:47:25 UTC (rev 311)
+++ pkg/inst/ChangeLog 2008-04-10 16:25:42 UTC (rev 312)
@@ -21,6 +21,10 @@
* allPerms: Now accepts a vector from which number of observations
can be deduced. This was the intended behaviour but allPerms failed
in such cases.
+
+ * adonis: Was not dropping empty levels of factors, which was
+ leading to incorrect results (d.f. was inflated). Reported by
+ Tyler Smith.
Version 1.12-8 (closed April 6, 2008)
More information about the Vegan-commits
mailing list