Re: [R] adding linear regression data to plot

From: Jim Lemon <>
Date: Thu, 17 Mar 2011 19:58:31 +1100

On 03/17/2011 02:47 AM, derek wrote:
> I know I can add line to graph with abline(), but I would like to print
> R-squared, F-test value, Residuals and other statistics from lm() to a
> graph. I don't know how to access the values from summary(), so that I can
> use them in a following code or print them in a graph.
Hi derek,
As Peter has already replied, you can use str() to find out the components of the summary. Try something like this:


where "result" is what has been returned by the call to "lm".

Jim mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 17 Mar 2011 - 10:04:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 17 Mar 2011 - 10:20:22 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive