[R] Newbie programming help

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Mon Aug 25 14:56:48 CEST 2008

Dear Steven,

Take a look at the lmList function in the nlme package. It does what you
want to do.



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
Namens Ranney, Steven
Verzonden: vrijdag 22 augustus 2008 23:34
Aan: r-help op r-project.org
Onderwerp: [R] Newbie programming help

All -

Not sure if this is a real programming question, but here goes:

I have data that looks like

Lake	Length	Weight
1	158	45
1	179	70
1	200	125
1	202	150
1	206	145
1	209	165
1	210	140
1	215	175
1	216	152
1	220	150
1	221	165

where lake goes from 1 - 84 and the number of rows for each lake is
variable (but > ~20). 
I'm trying to do two things: 1) build a simple linear model of the form


for every separate lake in the data set; 2) I'd like to save the
intercepts and slopes
from each of these linear regressions into a seperate data frame.  Any
ideas?  I think it would
probably require some kind of 'for' statement, but I'm just not that

Thanks for your help,


Steven H. Ranney
Graduate Research Assistant (Ph.D)
USGS Montana Cooperative Fishery Research Unit
Montana State University
PO Box 173460
Bozeman, MT 59717-3460

phone: (406) 994-6643
fax:   (406) 994-7479

	[[alternative HTML version deleted]]

R-help op r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document.
The views expressed in  this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document

More information about the R-help mailing list