Re: [R] regression by groups

2007-10-09 Thread Henrique Dallazuanna
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. > > j

Re: [R] regression by groups

2007-10-09 Thread Chuck Cleland
Jiong Zhang, PhD 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. Here is an example using the iris data: by(iris, iris$Species, function(x){ summary(lm(Sepal.Length ~ Sepal.Width +

[R] regression by groups

2007-10-09 Thread Jiong Zhang, PhD
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 sole...{{dropped:11}} __ R-help@r-project.org mailing lis