# NOT RUN {
# Correlation between the specified variable vs
# the remaining numeric variables in the data
#:::::::::::::::::::::::::::::::::::::::::
mtcars %>% cor_test(mpg)
# Correlation test between two variables
#:::::::::::::::::::::::::::::::::::::::::
mtcars %>% cor_test(wt, mpg)
# Pairwise correlation between multiple variables
#:::::::::::::::::::::::::::::::::::::::::
mtcars %>% cor_test(wt, mpg, disp)
# Grouped data
#:::::::::::::::::::::::::::::::::::::::::
iris %>%
group_by(Species) %>%
cor_test(Sepal.Width, Sepal.Length)
# Multiple correlation test
#:::::::::::::::::::::::::::::::::::::::::
# Correlation between one variable vs many
mtcars %>% cor_test(
vars = "mpg",
vars2 = c("disp", "hp", "drat")
)
# Correlation between two vectors of variables
# Each element in vars is tested against all elements in vars2
mtcars %>% cor_test(
vars = c("mpg", "wt"),
vars2 = c("disp", "hp", "drat")
)
# }
Run the code above in your browser using DataLab