View source: R/get_cor_matrix.R
get_cor_matrix | R Documentation |
The "get_cor_matrix" function calculates and visualizes the correlation matrix between two sets of variables in a dataset. It provides flexibility in defining correlation methods, handling missing values, and incorporating additional data. The function supports various correlation methods, such as Pearson correlation, and displays the correlation result in a customizable plot. The plot includes color-coded tiles representing the correlation value between each pair of variables. Additionally, the function offers options to save the plot and data for further analysis.
get_cor_matrix(
data,
feas1,
feas2,
method = "pearson",
path = NULL,
index = 1,
fig.type = "pdf",
width = NULL,
height = NULL,
project = NULL,
is.matrix = FALSE,
scale = T,
font.size.star = 8,
font.size = 15,
fill_by_cor = FALSE,
round.num = 1
)
data |
The input dataset for correlation analysis. Genes or signatures in columns. If data is a matrix, please set 'is.matrix' = TRUE, and data will be t() |
feas1 |
A vector of variable names representing the first set of variables for correlation analysis. |
feas2 |
A vector of variable names representing the second set of variables for correlation analysis. |
method |
The method used to calculate correlation. Default is "pearson". |
path |
The path to save the correlation plot. If not specified, the plot will be saved in a folder named "index-cor_matrix_plot". |
index |
A numeric value used for naming the output plot file. Default is 1. |
fig.type |
The file format of the output plot. Default is "pdf". |
width |
The width of the output plot. |
height |
The height of the output plot. |
project |
The name of the project or analysis. This will be used as the plot title. Default is NULL. |
is.matrix |
A logical value indicating whether the input data is a matrix. Default is FALSE. |
scale |
A logical value indicating whether to scale the data before correlation analysis. Default is TRUE. |
font.size.star |
The font size of the significance stars in the plot. Default is 8. |
font.size |
The font size of the axis labels and tick marks in the plot. Default is 15. |
fill_by_cor |
A logical value indicating whether to fill the tiles in the plot according to the correlation values. Default is FALSE. |
round.num |
The number of decimal places to round the correlation values. Default is 1. |
Dongqiang Zeng
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.