hey, Dennis, I applied your syntax into my data frame with different variable names. Specifically, I replaced y1 and y2, with ocbi and ocbo. I got the following error message. Could you please explain why would this happen? Again, thanks! > for(i in 1:5){fm1<-as.formula(paste('ocbi',ms[i],sep='~')) + fm2<-as.formula(paste('ocbo',ms[i],sep'~'))
Error: unexpected string constant in: "for(i in 1:5){fm1<-as.formula(paste('ocbi',ms[i],sep='~')) fm2<-as.formula(paste('ocbo',ms[i],sep'~'" -- View this message in context: http://r.789695.n4.nabble.com/how-to-run-linear-regression-models-at-once-tp3179256p3207726.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.