[Vegan-commits] r1324 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Oct 3 15:09:59 CEST 2010
Author: jarioksa
Date: 2010-10-03 15:09:59 +0200 (Sun, 03 Oct 2010)
New Revision: 1324
Modified:
pkg/vegan/R/ordistep.R
pkg/vegan/inst/ChangeLog
Log:
ordistep failed if fitted model had term 'mod'
Modified: pkg/vegan/R/ordistep.R
===================================================================
--- pkg/vegan/R/ordistep.R 2010-10-03 12:28:45 UTC (rev 1323)
+++ pkg/vegan/R/ordistep.R 2010-10-03 13:09:59 UTC (rev 1324)
@@ -33,18 +33,17 @@
}
}
scope <- factor.scope(ffac, list(add = fadd, drop = fdrop))
- mod <- object
## 'anotab' collects the changes into 'anova' object in the output
anotab <- NULL
if (trace) {
cat("\n")
- cat(pasteCall(formula(mod), prefix = "Start:"))
+ cat(pasteCall(formula(object), prefix = "Start:"))
}
for (i in 1:steps){
change <- NULL
## Consider dropping
if (backward && length(scope$drop)) {
- aod <- drop1(mod, scope = scope$drop, test="perm", pstep = pstep,
+ aod <- drop1(object, scope = scope$drop, test="perm", pstep = pstep,
perm.max = perm.max, alpha = Pout, trace = trace, ...)
aod <- aod[-1,]
o <- order(-aod[,5], aod[,4], aod[,2])
@@ -57,18 +56,18 @@
if (aod[1,5] > Pout) {
anotab <- rbind(anotab, aod[1,])
change <- rownames(aod)[1]
- mod <- eval.parent(update(mod, paste("~ .", change)))
- scope <- factor.scope(attr(terms(mod), "factors"),
+ object <- eval.parent(update(object, paste("~ .", change)))
+ scope <- factor.scope(attr(terms(object), "factors"),
list(add = fadd, drop = fdrop))
if (trace) {
cat("\n")
- cat(pasteCall(formula(mod), prefix = "Step:"))
+ cat(pasteCall(formula(object), prefix = "Step:"))
}
}
}
## Consider adding
if (forward && length(scope$add)) {
- aod <- add1(mod, scope = scope$add, test = "perm", pstep = pstep,
+ aod <- add1(object, scope = scope$add, test = "perm", pstep = pstep,
perm.max = perm.max, alpha = Pin, trace = trace, ...)
aod <- aod[-1,]
o <- order(aod[,5], aod[,4], aod[,2])
@@ -81,12 +80,12 @@
if (aod[1,5] <= Pin) {
anotab <- rbind(anotab, aod[1,])
change <- rownames(aod)[1]
- mod <- eval.parent(update(mod, paste( "~ .",change)))
- scope <- factor.scope(attr(terms(mod), "factors"),
+ object <- eval.parent(update(object, paste( "~ .",change)))
+ scope <- factor.scope(attr(terms(object), "factors"),
list(add = fadd, drop = fdrop))
if (trace) {
cat("\n")
- cat(pasteCall(formula(mod), prefix="Step:"))
+ cat(pasteCall(formula(object), prefix="Step:"))
}
}
}
@@ -95,6 +94,6 @@
break
}
cat("\n")
- mod$anova <- anotab
- mod
+ object$anova <- anotab
+ object
}
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2010-10-03 12:28:45 UTC (rev 1323)
+++ pkg/vegan/inst/ChangeLog 2010-10-03 13:09:59 UTC (rev 1324)
@@ -4,6 +4,9 @@
Version 1.18-13 (opened September 26, 2010)
+ * ordistep: name clash if the fitted model contained item or term
+ called 'mod'. Reported by Richard Telford (Bergen, Norway).
+
* fitspecaccum: Stephen Sefick suggested adding Michaelis-Menten
fit to random species accumulation and sent his model function.
These ideas were used to add a new more general function. No
More information about the Vegan-commits
mailing list