get_cor | R Documentation |
The "get_cor" function calculates and visualizes the correlation between two variables in a dataset. It provides options to scale the data, handle missing values, and incorporate additional data. The function supports various correlation methods and can display the correlation result. It generates a correlation plot with optional subtypes or categories, including a regression line. The plot can be customized with color palettes, labels, and titles. Additionally, the function allows saving the plot and data for further analysis.
get_cor(
eset,
pdata = NULL,
is.matrix = FALSE,
id_eset = "ID",
id_pdata = "ID",
var1,
var2,
scale = TRUE,
subtype = NULL,
na.subtype.rm = FALSE,
color_subtype = NULL,
palette = "jama",
index = NULL,
method = "spearman",
show_cor_result = T,
col_line = NULL,
id = "NULL",
show_lebel = FALSE,
point_size = 4,
title = NULL,
alpha = 0.5,
title_size = 1.5,
text_size = 10,
axis_angle = 0,
hjust = 0,
show_plot = TRUE,
fig.format = "png",
fig.width = 7,
fig.height = 7.3,
path = NULL,
save_plot = FALSE,
add.hdr.line = FALSE
)
eset |
A dataset containing the variables of interest. |
pdata |
An optional data frame providing additional data for the analysis. Default is NULL. |
is.matrix |
Whether the eset is a matrix data with feature as row names |
id_eset |
The column name in eset that contains unique identifiers. Default is "ID". |
id_pdata |
The column name in pdata that contains unique identifiers. Default is "ID". |
var1 |
The name of the first variable to analyze. |
var2 |
The name of the second variable to analyze. |
scale |
Whether to scale the data. Default is TRUE. |
subtype |
An optional variable that represents subtypes/categories in the analysis. Default is NULL. |
na.subtype.rm |
Whether to remove NA values in the subtype variable. Default is FALSE. |
color_subtype |
The color palette for the subtypes/categories. Default is NULL. |
palette |
The name of the color palette. Default is "jama". |
index |
The index of the plot. Default is NULL. |
method |
The correlation method to use. Default is "spearman". |
show_cor_result |
Whether to print the correlation result. Default is TRUE. |
col_line |
The color of the line in the correlation plot. Default is NULL. |
id |
The ID column name to use for labeling points on the plot. Default is "NULL". |
show_lebel |
Whether to show labels on the plot. Default is FALSE. |
point_size |
The size of the points on the plot. Default is 4. |
title |
The title of the plot. Default is NULL. |
alpha |
The transparency level of points on the plot. Default is 0.7. |
title_size |
The size of the title on the plot. Default is 2. |
text_size |
The size of the text on the plot. Default is 15. |
axis_angle |
The rotation angle of the axes labels on the plot. Default is 0. |
hjust |
The horizontal justification of the axes labels on the plot. Default is 0. |
show_plot |
Whether to display the plot. Default is TRUE. |
fig.format |
The format of the saved figure. Default is "png". |
fig.width |
The width of the saved figure. Default is 7. |
fig.height |
The height of the saved figure. Default is 7.3. |
path |
The path where the figure will be saved. Default is NULL. |
save_plot |
Whether to save the plot as a file. Default is FALSE. |
add.hdr.line |
add.hdr.line |
Dongqiang Zeng
data(eset_tme_stad, package = "IOBR")
get_cor(eset = eset_tme_stad, is.matrix = TRUE, var1 = "GZMB", var2 = "CD274")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.