correlation_network: Correlation network

Description Usage Arguments Examples

Description

Correlation network as a tidy graph

Usage

1
2
3
4
5
6
correlation_network(data, node_data = tibble::tibble(name =
  colnames(data)), correlation_method = c("pearson", "kendall",
  "spearman"), use = c("everything", "all.obs", "complete.obs",
  "na.or.complete", "pairwise.complete.obs"), threshold = 0.05,
  threshold_method = c("pvalue", "absolute"),
  adjust = stats::p.adjust.methods)

Arguments

data

input data, a numeric matrix or data frame.

node_data

additional data frame containing information for each node. Should have a column ''name'' that contains the column names of the data.

correlation_method

a character string indicating which correlatin coefficient to compute. One of '"pearson"' (default), '"kendall"', or '"spearman"'.

use

a character string indicating how to deal with missing values. One of '"everything"', '"all.obs"', '"complete.obs"', '"na.or.complete"', or '"pairwise.complete.obs"'.

threshold

a numeric threshold

threshold_method

a character string indicating how correlations should be thresholded. One of '"pvalue"' (default), or '"absolute"'.

adjust

a character string indicating how p-values should be adjusted for multiple comparisons. See p.adjust.methods for all methods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data('mtcars')
graph_cors <- correlation_network(mtcars)
graph_cors
## Not run: 
require(ggraph)
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()

## End(Not run)

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