09 September 2015 8 7K Report

Hello all,

I have a matrix of gene-expression data from 50 samples whose rows are the probes and whose columns are the samples. There is an additional column consisting of the Entrez gene IDs for the probes. I also have a vector containing a list of all the genes (Entrez IDs) that this matrix shares with one from another experiment.

How would I subset this matrix to select only the probes (rows) whose Entrez ID is in the vector?

I have tried this code already: myMatrix[myMatrix[,"ID"] %in% commonGenes,]

where myMatrix is my data matrix, ID is the name of the column containing the Entrez IDs, and commonGenes is the character vector containing the list of all the desired Entrez IDs; but this doesn't work (I still get back all the rows.)

More Lon W. R. Fong's questions See All
Similar questions and discussions