Description Usage Arguments Details Value Examples
Perform pairwise correlations formatted for BART
1 2 3 |
x |
A numeric matrix or data frame. |
y |
A second numeric matrix or data frame with the same number of rows
as |
by |
Default is NULL. A grouping vector with length equal to
|
by.name |
Default is NULL. String denoting the name of the grouping factor. |
description |
String giving description of what's being correlated. Default is "X vs Y". |
x.var |
String denoting type of variables in |
y.var |
String denoting type of variables in |
method |
Default is set to "pearson". The alternatives are "spearman" and "kendall". |
order.by |
Order by p-value ("p") or correlation value ("r"). Default is "p". |
decreasing |
logical. Should the sort be increasing or decreasing? Default is TRUE. |
This function uses the corr.test function in
the pysch package to find the correlations and p-values. It then
formats the results in a tall format for BART.
corrs Tall data frame of correlations and p-values.
corr.files A data frame obtained by cbind(by,x,y).
corr.names A string denoting the description of the variables
being correlated.
x.var String denoting type of variables in x.
y.var String denoting type of variables in y.
corr.method One of "pearson", "spearman", or "kendall".
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Example data
data(tb.flow)
# Format expression data to align with flow data
gene.data <- data.frame(t(tb.expr[1:100, ]))
rownames(gene.data) <- paste0(tb.design$monkey_id, "_", tb.design$timepoint)
flow.data <- data.frame(t(tb.flow))
flow.data <- flow.data[match(rownames(gene.data), rownames(flow.data), nomatch = 0), ]
gene.data <- gene.data[match(rownames(flow.data), rownames(gene.data), nomatch = 0), ]
# Create time variable
time <- tb.flow.des$timepoint[match(rownames(flow.data),tb.flow.des$columnname,nomatch = 0)]
# Run correlations and format for BART
corrs <- crossCorr(x = gene.data, y = flow.data, by = time, by.name = "days",
description = "Genes vs Flow", x.var = "Genes",
y.var = "Flow", method = "spearman")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.