get_var_corr {manymodelr} | R Documentation |
Get correlations between variables
Description
This function returns the correlations between different variables.
Usage
get_var_corr(
df,
comparison_var = NULL,
other_vars = NULL,
method = "pearson",
drop_columns = c("factor", "character"),
...
)
Arguments
df |
The data set for which correlations are required |
comparison_var |
The variable to compare to |
other_vars |
variables for which correlation with comparison_var is required. If not supplied, all variables will be used. |
method |
The method used to perform the correlation test as defined in 'cor.test'. Defaults to pearson. |
drop_columns |
A character vector specifying column classes to drop. Defaults to c("factor","character") |
... |
Other arguments to 'cor.test' see ?cor.test for details |
Value
A data.frame object containing correlations between comparison_var and each of other_vars
Examples
# Get correlations between all variables
get_var_corr(mtcars,"mpg")
# Use only a few variables
get_var_corr(mtcars,"mpg", other_vars = c("disp","drat"), method = "kendall",exact=FALSE)
[Package manymodelr version 0.3.7 Index]