explainedVariance(data, num_mainvar = 1, num_covariates = 0, variable_label = NULL)explainedVariance computes R2 via linear models. The first column
is considered to be the dependent variable. Therefore, a lineal model will be
constructed for each of the remaining variables. In case that covariates
were included, they will be included in all the models and, in addition, a model
containing only the covariates will be returned.Some variables can be grouped in the models to assess their effect together.
data(mtcars)
R2 <- explainedVariance(mtcars)
R2
Run the code above in your browser using DataLab