[R] select a subset of a matrix which one of its column meet a condition

Lida Zeighami lid.zigh at gmail.com
Wed Jul 8 17:37:54 CEST 2015


Hi there,

I have a matrix and I want to get a subset from that which one of its
matrix meet a condition,

my matrix is
met
     Row.names             Name
maf                                   caf
1 10:100003915      10:1000039              0.0003782148
0.0003782148
2 10:100008738      10:100008738           0.0003759398
 0.0003759398
3 10:100011321      10:100011321           0.0003762227
 0.0003762227
4 10:100012219      10:100012219           0.0007518797
0.0007518797
5 10:100013325      10:100013325          0.0000000000
 0.0000000000
6 10:100015404      10:100015404          0.0000000000
0.0000000000

I want to choose a subset from "met" which maf values are between 0 and
0.05 (0,0.05)

I wrote this code, but seem doesn't work properly:

> maf<- met[which(c(met[,5]) %in% c(0,0.05)),]

the dim(maf)  is 0 so seems my code didn't work!
would please let me know how to correct it?

Thanks

	[[alternative HTML version deleted]]



More information about the R-help mailing list