BioMan
BioMan

Reputation: 704

Filter rows based on values in a column

How can I filter out the rows in which the value in a specific column of the matrix is above a certain value. For instance how do I filter the rows in the below matrix where logCPM is above 0.2?

> mydata

         logFC     logCPM          LR     PValue       FDR
1  0.552704905 0.18660575 2.805573421 0.09393725 0.1744389
2  0.179752394 0.12956983 0.264209389 0.60724288 0.7164197
3  0.135260378 0.99331911 0.334612036 0.56295589 0.6789419
4  0.007554301 0.66189664 0.001413451 0.97000988 0.9809448
5 -0.107374125 2.56150056 0.251272726 0.61618033 0.7237010
6  0.062867911 0.04769834 0.018075575 0.89305036 0.9300404

Upvotes: 1

Views: 7995

Answers (2)

user2300940
user2300940

Reputation: 2385

Try this

mydata[mydata$logCPM > 0.2,]

Upvotes: 0

akrun
akrun

Reputation: 886938

You can try

 mydata[mydata[,'logCPM']>0.2,]

Upvotes: 2

Related Questions