rSquared( y, resid )
data( Blanciforti86 )
reg <- lm( wFood1 ~ pFood1 + xFood, Blanciforti86 )
rSquared( Blanciforti86$wFood1, reg$residuals )
summary( reg )$r.squared # returns the same value
Run the code above in your browser using DataLab