Description Usage Arguments Value Author(s) See Also Examples
View source: R/cortestmatrices.R
This is a wrapper function for cor.test
, given a matrix of
interaction values, correlations and corresponding p-values for the
genewise interaction profiles are calculated.
1 | cortestmatrices(mat, method = c("pearson", "kendall", "spearman"))
|
mat |
|
method |
character deciding which correlation method should be used |
List of two matrices
cor.matrix |
matrix with correlations |
p.matrix |
matrix with p-values |
Elin Axelsson
1 2 3 4 5 6 7 8 9 10 11 12 | ## simulate data with 2 genes with similar profiles
mat = matrix(rnorm(100*100,0,1),100,100)
pr = sample(2:10,100,replace=TRUE)
mat[1:2,] = mat[1:2,] + matrix(pr,ncol=100,nrow=2,byrow=TRUE)
mat = mat+t(mat)
diag(mat) = NA
dimnames(mat)=list(1:100,1:100)
res = cortestmatrices(mat,method="spearman")
cors= res[[1]]
ps = res[[2]]
print(which(ps==min(ps,na.rm=TRUE),arr.ind=TRUE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.