[R] Scoping rule problem -- solved: Code
Winfried Theis
theis at statistik.uni-dortmund.de
Wed Jan 29 16:08:05 CET 2003
Here comes the corrected code of my function, sorry for not posting it in the
earlier message.
fitlms <- function(y,infl,formel=NULL){
if(is.null(formel)){
var.names <- names(infl)
dcv <- length(var.names)
formel <- paste("y~",paste(rep("I(",dcv), var.names,
rep("^2)",dcv),sep="",collapse="+"),"+",paste(var.names,collapse="*"),sep="")
formel <- as.formula(formel)
}
erg <- lm(formel) #<- Here I omit now the data=infl statement.
erg <- step(erg)
return(erg)}
This does work if "formel" is a formula-object, one should check for it, to
secure things...
Cheers, Winfried
---------------------------------------------------------------------
E-Mail: Winfried Theis <theis at statistik.uni-dortmund.de>
Date: 29-Jan-03
Dipl.-Math. Winfried Theis
SFB 475, Fachbereich Statistik, Universit"at Dortmund, 44221 Dortmund
Tel.: +49-231-755-5903 FAX: +49-231-755-4387
----------------------------------------------------------------------
More information about the R-help
mailing list