correctIndices {metagenomeSeq} | R Documentation |
Consider the upper triangular portion of a matrix of size nxn. Results from the correlationTest
are output
as the combination of two vectors, correlation statistic and p-values. The order of the output is 1vs2, 1vs3, 1vs4, etc.
The correctIndices returns the correct indices to fill a correlation matrix or correlation-pvalue matrix.
correctIndices(n)
n |
The number of features compared by correlationTest (nrow(mat)). |
A vector of the indices for an upper triangular matrix.
data(mouseData) mat = MRcounts(mouseData)[55:60,] cors = correlationTest(mat) ind = correctIndices(nrow(mat)) cormat = as.matrix(dist(mat)) cormat[cormat>0] = 0 cormat[upper.tri(cormat)][ind] = cors[,1] table(cormat[1,-1] - cors[1:5,1])