After reviewing other stackoverflow posts, I am attempting to add a regression line to my scatter plot with:
plot(subdata2$PeakToGone, subdata2$NO3_AVG, xlim = c(0, 70))
abline(lm(PeakToGone~NO3_AVG, data = subdata2))
However, it is not showing the line. I would also like to add the R^2, RMSE, and p-value from lm as text on the plot.
How can I add the regression line to the plot, along with these goodness-of-fit stats?
By default, plot regards the 1st param as
x
and the 2nd asy
. Tryand look if the line is visible, now. You'll find an answer to your 2nd question here.