[R] abline is not plotting

S Ellison S.Ellison at lgcgroup.com
Fri Oct 4 17:49:23 CEST 2013


 
> I have some data I want to plot together with a best-fit line. (see MWE
> below)
...
> Can someone help me with that? What am I doing wrong?

Not logging the lm. Also, you've calculated lm() the wrong way round; you've regressed x on y.

Try

plot(log(d), xlab="log(x)", ylab="log(y)")
abline(lm(y ~ x, data = log(d)))

S Ellison




*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}



More information about the R-help mailing list