Off topic:Extracting row and column names from matrix in R.
0
0
Entering edit mode
8.8 years ago
kandoigaurav ▴ 150

I've two large matrices with p-values and correlation coefficients for lncRNA vs mRNA genes (both matrix have same structure, one has p-values while the other has corresponding correlation coefficients). I would like to extract all lncRNA-mRNA gene pairs for which the p-value is less than 0.05 and their corresponding correlation coefficients as well.

I'm using the following R script which gives me the row and column number, but I also want the names, i.e lncRNA and mRNA gene names:

Pmatrix = read.csv ("pmatrix.csv", header = FALSE) ##read the matrix with pvalues
sig_values <- which(Pmatrix<0.05, arr.in=TRUE) ##extract values less than 0.05
sig_values #list all (row,col) pairs with pvalues less than 0.05
Corr_Matrix = read.csv("corr_matrix.csv", header = FALSE) ##read the matrix with correlation values
Corr_Matrix[sig_values] ##list correlation values corresponding to pvalues less than 0.05.

This gives me a list of row and column numbers, but how can I get the names?

Correlation Matrix R • 13k views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2241 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6