View source: R/compare_cor_ci.R
compare_cor_ci | R Documentation |
Performs pairwise correlations of features with adjusted p-values. Correlations and confidence intervals calculated for each sample group.
compare_cor_ci(
mat,
group,
method = "pearson",
adjust = "BH",
alternative = "two.sided",
conf_level = 0.95
)
mat |
matrix with features in columns. correlations calculated between feature pairs for each group |
group |
group assignment of samples corresponding to rows in mat. |
method |
correlation method pearson, spearman, kendall |
adjust |
multiple testing correction method. BH, BY, fdr, hom, hochberg, hommel, bonferroni, none |
alternative |
two.sided, greater, less |
conf_level |
confidence level for the returned confidence interval. |
Returns a dataframe. x = x variable y = y variable group = sample group n = number of samples in group r = correlation coefficient p = p-value p.adj = adjusted p-value lower_ci = lower confidence interval upper_ci = upper confidence interval
# load example data
data(dss_example)
# subset features, features in columns
feat_mat <- dss_example$merged_abundance_id[1:6,2:26]
rownames(feat_mat) <- dss_example$merged_abundance_id[1:6,1]
feat_mat <- t(feat_mat)
# metadata in same order
met_df <- dss_example$metadata
met_df <- met_df[match(rownames(feat_mat), met_df$sampleID),]
compare_cor_ci(feat_mat, met_df$Phenotype)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.