[R] how to run linear regression models at once

David Winsemius dwinsemius at comcast.net
Mon Jan 10 20:22:42 CET 2011

On Jan 10, 2011, at 1:29 PM, wangwallace wrote:

> 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<- 
> Error: unexpected string constant in:
> "for(i in 1:5){fm1<-as.formula(paste('ocbi',ms[i],sep='~'))

When you get a message like that it is going to be a missing  
<something>, usually right near the end of the presented string in the  
error message,
  ,,, and in your case it is a missing "=" sign,

> 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 at 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.

David Winsemius, MD
West Hartford, CT

More information about the R-help mailing list