ggally_cor | R Documentation |
Estimate correlation from the given data. If a color variable is supplied, the correlation will also be calculated per group.
ggally_cor(
data,
mapping,
...,
stars = TRUE,
method = "pearson",
display_grid = FALSE,
digits = 3,
title_args = list(...),
group_args = list(...),
justify_labels = "right",
align_percent = 0.5,
title = "Corr",
na.rm = NA,
use = deprecated(),
alignPercent = deprecated(),
displayGrid = deprecated()
)
Barret Schloerke
ggally_statistic
, ggally_cor_v1_5
# Small function to display plots only if it's interactive
p_ <- GGally::print_if_interactive
data(tips)
p_(ggally_cor(tips, mapping = ggplot2::aes(total_bill, tip)))
# display with grid
p_(ggally_cor(
tips,
mapping = ggplot2::aes(total_bill, tip),
display_grid = TRUE
))
# change text attributes
p_(ggally_cor(
tips,
mapping = ggplot2::aes(x = total_bill, y = tip),
size = 15,
colour = I("red"),
title = "Correlation"
))
# split by a variable
p_(ggally_cor(
tips,
mapping = ggplot2::aes(total_bill, tip, color = sex),
size = 5
))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.