[BioC] conditional selection: extracting row from matrix

Straubhaar, Juerg Juerg.Straubhaar at umassmed.edu
Tue Jan 6 18:34:43 MET 2004


I have an (n,m) matrix with rownames and colnames. The rownames are probe set ids. I know a value of one of the probe sets which is, say, in column 2 of the matrix. I would like to retrieve the rowname, or probe set id, of the row which contains this value.

Neither of these work:

matrix[,matrix[,2]==513.193057]
(Error: (subscript) logical subscript too long)

index <- which(matrix[,2] == 513.193057)
matrix[index,]

Of course, I could write.table() the matrix and search the file. But I would like to know how this is done in R/Bioconductor.

Thank you very much.

Juerg Straubhaar,
Umass Med



More information about the Bioconductor mailing list