> x <- 1:10
> y <- 2 + 1.5 * rnorm(10, x, 2)
> m <- lm(y ~ x)
> summary(m)$r.squared
[1] 0.6056889
> anova(m)$'Pr(>F)'
[1] 0.0080142        NA

Components of the summary() and anova() methods of lm() can be extracted.
See

names(summary(m))
names(anova(m))

to see the components one can extract.

HTH, Dennis


On Fri, Jan 29, 2010 at 6:04 AM, wenjun zheng <wjzhen...@gmail.com> wrote:

> Hi, R Users
>
> I find a problem in extracting the R-squared and P-value from the lm
> results
> described below (in Italic),
>
> *Residual standard error: 2.25 on 17 degrees of freedom*
> *Multiple R-squared: 0.001069,   Adjusted R-squared: -0.05769 *
> *F-statistic: 0.01819 on 1 and 17 DF,  p-value: 0.8943 *
> *
> *
> Any suggestions will be appreciated. Thanks.
>
> Wenjun
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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