Subseting data.frames with more than 1 condition

前端 未结 2 1882
心在旅途
心在旅途 2021-01-27 16:45

I found this question to be similiar to mine, but I need to know a way to do the same thing with mathematical conditions such as less or equal than or greator or equal (<=, >

相关标签:
2条回答
  • 2021-01-27 17:06

    Just concatenate the expressions with & (AND) or | (OR)

    Using subset

     subset(DF, GENProm < 0.5 & matricula > 10)
    

    Or, more safely, [

    DF[DF[['GENProm']] < 0.5 & DF[['matricula']] > 10, ]
    
    0 讨论(0)
  • 2021-01-27 17:06

    temp is the original dataset, and temp.1 is the dataset after subsetting.

    temp.1 <- temp[temp[,"GENProm"]<0.5 & temp[,"matricula"]>10,]
    
    0 讨论(0)
提交回复
热议问题