[R] Deleting multiple rows from a data matrix based on exp value
Peter Davidsen
pkdavidsen at gmail.com
Sun Nov 20 23:45:47 CET 2011
Dear List,
I have a data matrix that consists of ~4500 rows and 25 columns (i.e.
an exprSet object that I converted via the 'exprs' function into a
data matrix)
Now I want to remove/delete the rows where all exp. values in that
particular row are below or equal to a specific cut-off value (e.g
1.11)
I have tried using several commands to address this issue:
>Matrix[rowSums(Matrix <= 1.11) <= 1.11, ]
or
>Matrix[ !apply(Matrix<=1.11,1,all), ]
The above commands seem to work fine when I generate a small "test" matrix like:
>M <- matrix(c(2,5,8,0.4,0.8,0.5,4,12,3), nrow=3, byrow=T)
However, non of the two commands decrease the number of rows in my real matrix!
Any help would be appreciated
Kind regards,
Peter
More information about the R-help
mailing list