View source: R/EnrichmentAnalysis.R
getTopCorrelationPairs | R Documentation |
Extracts the top positively and negatively correlated variable pairs from a correlation matrix.
getTopCorrelationPairs(corMat, nTop = 5)
corMat |
A square numeric matrix representing correlations between variables. Should have row and column names. |
nTop |
An integer specifying the number of top positive and negative correlation pairs to return. Defaults to 5. |
A list with two data frames:
Data frame of the top nTop
most positively correlated variable pairs.
Data frame of the top nTop
most negatively correlated variable pairs.
# Generate a random correlation matrix
set.seed(123)
mat <- matrix(rnorm(100), ncol = 10)
corMat <- cor(mat)
result <- getTopCorrelationPairs(corMat, nTop = 3)
result$topPositive
result$topNegative
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.