mat_cor_do | R Documentation |
compute correlations among all variables
mat_cor_do(df, add_stars = TRUE, digits = 2, ...)
df |
data |
add_stars |
Add column |
digits |
if |
... |
further arguments passed to |
mat_cor_to_df
x1 <- rnorm(100)
x2 <- 0.2 * x1 + rnorm(100)
x3 <- 0.9 * x1 + rnorm(100, sd=0.1)
x4 <- rnorm(100)
x <- data.frame(x1, x2, x3, x4)
mat_cor_do(x)
mat_cor_do(x, add_stars = TRUE)[, c(1,2,3,4,5,11)]
mat_cor_do(x, method = "kendall")
mat_cor_do(x, method = "kendall", alternative = "greater", add_stars = TRUE)
## plot
library(ggplot2)
ggplot(aes(x = variable, y= variable2, fill = estimate), data = mat_cor_do(x)) +
geom_tile() +
geom_text(aes(label = estimate_pval)) +
scale_fill_gradient2()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.