[R] lmList, tapply() and lm()

Marc Belisle marc.m.belisle at usherbrooke.ca
Fri Feb 15 17:00:20 CET 2008


Howdee,

*** I know that the lmList() function exists, yet I don't want to use it.
***

Would anyone be kind enough to tell how I can apply the function lm() to
each level of a given factor so to obtain the intercept and slope for each
factor level within a matrix?

For instance, suppose a dataframe containing 3 variables: id, x and y.

I want to compute the function lm() for each level contained in id, as
lmList would do...

Thanks for your time,

Marc

===================
Marc Bélisle
Professeur adjoint
Chaire de recherche du Canada en écologie spatiale et en écologie du paysage
Département de biologie
Université de Sherbrooke
2500 Boul. de l'Université
Sherbrooke, Québec
J1K 2R1 Canada

Tél: +1-819-821-8000 poste 61313
Fax: +1-819-821-8049
Courriél: Marc.M.Belisle at USherbrooke.ca



More information about the R-help mailing list