Entering edit mode
5.0 years ago
xxxxxxxx
▴
20
my matrix is like this-
MU101188 MU101310 MU101326 MU10251
MU101188 1 0.506 -0.006 -0.006
MU101310 -0.006 1 -0.006 -0.006
MU101326 -0.006 -0.006 1 -0.006
MU10251 -0.006 -0.006 0.806 1
I need to extract all pairs with their value for which the value is greater than or equal to 0.5. I m using the following R script which gives me the row and column name, but I also want a 3rd column consist of its value
Pmatrix = read.csv ("file.csv", header= TRUE, row.names = 1)
sig_values <- which(Pmatrix>=0.5, arr.in=TRUE)
cbind.data.frame(colIDs = colnames(Pmatrix)[ sig_values[, 1] ],rowIDs = rownames(Pmatrix)[ sig_values[, 2] ] )