R/FSAUtils.R
rSquared.RdExtracts the coefficient of determination (i.e., “r-squared”) from a linear model (i.e., lm) object.
rSquared(object, ...) # S3 method for default rSquared(object, ...) # S3 method for lm rSquared(object, digits = getOption("digits"), percent = FALSE, ...)
| object | An object saved from |
|---|---|
| ... | Additional arguments for methods. |
| digits | A single number that is the number of digits to round the returned result to. |
| percent | A logical that indicates if the result should be returned as a percentage ( |
A numeric, as either a proportion or percentage, that is the coefficient of determination for a linear model.
This is a convenience function to extract the r.squared part from summary(lm).
#> [1] 0.1812022rSquared(lm1,digits=3)#> [1] 0.181rSquared(lm1,digits=1,percent=TRUE)#> [1] 18.1