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:

plot(d,r2)
abline(res,col="red")

and all will be in harmony in the Universe.

cheers,

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

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to