R Subsetting a data.frame when 2 columns have different values

偶尔善良 提交于 2019-12-02 03:17:30

You can do this by finding the rows where Type1 and Type2 are not equal with the != logical operator. If df is the data,

> df[with(df, Type1 != Type2), ]
#       Type1 rep1    Type2 rep2    stat p.value
# 17    DqSAD    1 rnzDqSAD    9  3.7946  0.0101
# 19    DqSAD    1 rnzDqSAD   10  0.4111  0.2231
# 20 rnzDqSAD    1    DqSAD    2 -0.3111  0.5085
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!