Code to look at the effects of using r-squared versus adjusted r-squared. (Contributed by George Skountrianos)
From GS: "The adj.R2 function looks at the effect of what happens when we only rely on R-squared (R2) and not the adjusted R-squared for model diagnosis. The issue with R2 is that it will converge to 1 as the ratio of independent variables to number of observations per variable approches 1. This is true even if all the variables are independent of the response variable! In other words, R2 will say you have a strong fit and high percentage of variance explained even if all the predictor variables are independent of the response."
See the attached file below.