You can see the structure of the object returned by summary()
by calling str(summary(fit))
. Each piece can be accessed using $
. The p-value for the F statistic is more easily had from the object returned by anova
.
Concisely, you can do this:
rSquared <- summary(fit)$r.squared
pVal <- anova(fit)$'Pr(>F)'[1]