How do I display the gradient of the regression line in ggplot. Better still, how do I have the gradient returned along with the graph.

what do I add to a ggplot(... geom_smooth(method=lm)) form of argument to get it to display the gradient of the regression line as a number on the graph?

what would be even better is if R could return the gradient of the regression directly to the console along with the graph when the script runs.

apologies for the weird question with no reproducible examples provided im only looking for a very general method here, the specifics of my case are irrelevant and difficult to explain

I would advise you not to do regression on the fly within a plotting code.
rather perform regression, and then build plotting code around it.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.