Tidy Correlation Matrices and 'ggplot2' Correlograms

Computes correlation matrices as tidy data frames and creates publication-ready correlograms with 'ggplot2'. The package is designed for teaching and exploratory analysis workflows where users want one consistent interface for selecting numeric variables, calculating pairwise correlations, optionally estimating p-values, reordering variables, and drawing tile, point, or mixed correlograms.


tidycorrgram

tidycorrgram turns numeric data into tidy correlation tables and ggplot2 correlograms.

The package is meant for the common teaching and exploratory analysis workflow: choose numeric variables, compute pairwise correlations, optionally compute p-values, reorder the matrix, and draw a tile, point, or mixed correlogram.

Installation

install.packages("tidycorrgram")

During development, install from a local checkout:

install.packages("tidycorrgram", repos = NULL, type = "source")

Example

library(tidycorrgram)

corrgram_data(mtcars, columns = c("mpg", "disp", "hp", "wt"))

corrgram(
  mtcars,
  columns = c("mpg", "disp", "hp", "wt"),
  geom = "mixed",
  reorder = "hclust",
  p_values = TRUE
)

Why this package?

Baseline ggplot2 can draw a correlogram once correlations have already been computed and reshaped. tidycorrgram provides that missing glue in a small, teachable API while still returning ordinary data frames and ggplot2 objects.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("tidycorrgram")

0.1.0 by Xinyu Zhang, 4 months ago


https://github.com/zhangx60/tidycorrgram


Report a bug at https://github.com/zhangx60/tidycorrgram/issues


Browse source code at https://github.com/cran/tidycorrgram


Authors: Xinyu Zhang [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports ggplot2, stats


See at CRAN