This is a test version of Biostars. For the public version, visit https://www.biostars.org.
conversion of co-expression matrix in to vector using R

Hi, I have obtained a co-expression matrix (size=17740*17740) as below using R.

          gene1        gene2        gene3       
gene1     1.00000000 -0.43360020  0.64476873  
gene2    -0.43360020  1.00000000 -0.19004216  
gene3     0.64476873 -0.19004216 -0.06267813

I want to convert it as below.

gene1 gene1 1
gene1 gene2 -0.43360020
.
.

How can I do this?

Thank You

r

1 answer

Use the gather() function in the tidyr package.

Thank you. I used melt() function of reshape and got the result.

Log in to answer this question.