How to create correlation network plots with corrr and ggraph (and which countries drink like Australia)
@drsimonj here to show you how to use ggraph and corrr to create correlation network plots like these:
ggraph and corrr
The ggraph package by Thomas Lin Pedersen, has just been published on CRAN and it’s so hot right now! What does it do?
“ggraph is an extension of ggplot2 aimed at supporting relational data structures such as networks, graphs, and trees.”
A relational metric I work with a lot is correlations. Becuase of this, I created the corrr package, which helps to explore correlations by leveraging data frames and tidyverse tools rather than matrices.
- corrr creates relational data frames of correlations intended to work with tidyverse tools like ggplot2.
- ggraph extends ggplot2 to help plot relational structures.
Seems like a perfect match!
We’ll be using the following libraries:
library(tidyverse) library(corrr) library(igraph) library(ggraph)
Continue reading →