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