[R] Linear regression on several groups

JesperHybel jesperhybel at hotmail.com
Fri Aug 13 14:56:09 CEST 2010


Example is spot on - sr for not providing one myself.
The results you calculate are what I'm looking for.

Would like a function F where I could type:

F(weight ~ Time, data = ChickWeight, SOME ARGUMENT = Diet))

Resulting in

for (i in 1:4){
print(

lm(weight ~ Time, data = ChickWeight, subset = Diet==i)

)
}

I'm simply trying to minimize amount of looping and typing etc.

BR Jesper




-- 
View this message in context: http://r.789695.n4.nabble.com/Linear-regression-on-several-groups-tp2322835p2324154.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list