Try this also: lapply(df[,which(sapply(df, is.factor))], function(reg)lm(df$x~reg))
On 09/10/2007, Jiong Zhang, PhD <[EMAIL PROTECTED]> wrote: > > Hi All, > > I want to run regression (lm) on my dependant variable by gender and race. > How do I integrate the "by" function in lm? > > thanks. > > jiong > The email message (and any attachments) is for the sol...{{dropped:20}} ______________________________________________ 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.