How to calculate the 'Coefficient of determination' for a linear model in R?
Use summary(model) to print a point by point yield into de reassurance. You can likewise utilize str to investigate the structure of an item, for instance str(summary(model)) this is valuable when you can to extricate some portion of that yield utilizing $.
result <- summary(model) # summary of the model
str(result) # see structure of the summary
result$r.squared
Result contains both, R.squared and Adjusted R squared, see for example the following output
Residual standard error: 0.09178 on 148 degrees of freedom
Multiple R-squared: 0.9643,
Adjusted R-squared: 0.964
F-statistic: 3992 on 1 and 148 DF
p-value: < 2>
Output is just the last part of summary(model) printed in the console