Look at the lmList function in the nlme package, it does what I think you want.
-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Francesco Nutini > Sent: Friday, May 20, 2011 3:18 AM > To: [R] help > Subject: [R] [r] regression coefficient for different factors > > > Dear R-helpers, > > In my dataset I have two continuous variable (A and B) and one factor. > I'm investigating the regression between the two variables usign the > command > lm(A ~ B, ...) > but now I want to know the regression coefficient (r2) of A vs. B for > every factors. > I know that I can obtain this information with excel, but the factor > have 68 levels...maybe [r] have a useful command. > > Thanks, > > Francesco Nutini > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. ______________________________________________ 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.