[R] abline?

Rolf Turner r.turner at auckland.ac.nz
Thu Jan 22 22:27:34 CET 2015

On 23/01/15 08:39, Dennis P. Weygand wrote:
> I am a very new user of R, trying to do a linear fit to data,
> plot(r2,d)
> plots my data correctly, I do a linear fit:
> res = lm(r2~d)
> gives a fit to the data, but
> abline(res,col=“red”)
> displays nothing. Again, I am a novice, but what am I doing wrong?

Mixing up your x and y coordinate.  Do:


and all will be in harmony in the Universe.


Rolf Turner

Rolf Turner
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
Home phone: +64-9-480-4619

More information about the R-help mailing list