简体   繁体   English

如何使用R中两列的条件从数据框中选择行

[英]how to select rows from a data frame using a condition from two columns in R

I am doing differentially gene expression analysis and have a data frame with p.values that are <0.05 for both conditions (columns). 我正在做差异基因表达分析,并且有一个数据框,其p。值在两种情况下(列)均小于0.05。 I will like to filter the p.values that are <0.05 for one column with the condition that it would not be <0.05 on the second column. 我想过滤一列的<0.05的p。值,条件是第二列的<0.05。

df
    row.names        padj.co         padj.c2
1   1.1.1.m1    5.789924e-02    1.745791e-02
2   1.1.100.m1  5.875004e-14    3.459149e-14
3   1.1.1000.m1 3.511273e-11    4.045594e-11

Any ideas will be very much appreciated. 任何想法将不胜感激。

Thanks 谢谢

You can use 您可以使用

df[df$padj.co < 0.05 & df$padj.c2 >= 0.05, ]

I don't think I understand your second question without more background. 没有更多的背景,我想我不会理解你的第二个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM