[R] How to get the intercept from lm?

Rainer M Krug rkrug at sun.ac.za
Fri Mar 10 11:17:08 CET 2006


I am using R 2.2.0 under SuSE 10

I want to use lm() to get the slope and intercept for several daatasets 
and store them in a database. So far so good - but how do I extract the 
slope and the intercept from the result from lm()?

my code looks like this:

lmNNDens <- lm(log(DensNN$MeanNN) ~ log(DensNN$MeanDensity))
anovaLM <- anova(lmNNDens)

Results$slope[No] <- ???lmNNDens???
Results$intercept[No] <- ???lmNNDens???

any help welcome,


Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT)

Department of Conservation Ecology
University of Stellenbosch
Matieland 7602
South Africa

Tel:        +27 - (0)72 808 2975 (w)
Fax:        +27 - (0)21 808 3304
Cell:        +27 - (0)83 9479 042

email:    RKrug at sun.ac.za
           Rainer at krugs.de

More information about the R-help mailing list