Travis-CI Build Status Coverage Status

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

cornet: Correlation networks with R

Correlation networks based on a correlation threshold can easily be built using the corrr and ggraph packages. Unfortunately the use a p-value threshold was not as straightforward. This package makes it easy to create correlation networks based on either correlation thresholds or p-value thresholds.

Installation

You can install cornet from github with:

# install.packages("devtools")
devtools::install_github("blasern/cornet")

Example

Let's have a look at a correlation network for the mtcars dataset.

require(cornet)
require(ggraph)

data('mtcars')
graph_cors <- correlation_network(mtcars, 
                                  correlation_method = 'pearson',
                                  threshold = 0.05, 
                                  threshold_method = 'pvalue', 
                                  adjust = 'holm')

set.seed(42)
ggraph(graph_cors, layout = "graphopt") + 
  geom_edge_link(aes(color = r), width = 1.3) +
  geom_node_label(aes(label = name)) + 
  scale_edge_colour_gradient2(limits = c(-1, 1)) +
  theme_graph()

Development

If you find issues, please let me know. If you would like to contribute, please create a pull request.



blasern/cornet documentation built on May 19, 2019, 9:37 p.m.