cortestmatrices: Function to extract correlations and corresponding p-values...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/cortestmatrices.R

Description

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.

Usage

1
cortestmatrices(mat, method = c("pearson", "kendall", "spearman"))

Arguments

mat

mat interaction matrix

method

character deciding which correlation method should be used

Value

List of two matrices

cor.matrix

matrix with correlations

p.matrix

matrix with p-values

Author(s)

Elin Axelsson

See Also

cor.test

Examples

 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))

coRNAi documentation built on Nov. 17, 2017, 11:14 a.m.