Could someone point me in the right direction for the following issue:
A function is defined as follows:
tfun <- function(dat)
{
fmla <- as.formula("y~x+z")
dat2 <- dat
mdl <- lm(fmla,dat2)
mdl <- step(mdl)
}
Then the following code
dat <- data.frame(x=1:10,z=1:10,y=(1:10)^2+10*(1:10))
tfun(dat)
generates the output
Start: AIC= 43.67
y ~ x + z
Error in model.frame.default(formula = y ~ z, data = dat2,
drop.unused.levels = TRUE) :
Object "dat2" not found
Any help or pointers gratefully accepted.
Thanks,
Darryl Greig ([EMAIL PROTECTED])
______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help