How to programatically compare an entire row in R?

前端 未结 3 1896
暖寄归人
暖寄归人 2021-01-23 10:26

I have the following dataframe in R:
data= Time X1 X2 X3 1 1 0 0 2 1 1 1 3 0 0 1 4 1 1 1 5 0 0 0 6 0 1 1 7 1 1 1 8 0 0

3条回答
  •  时光说笑
    2021-01-23 10:49

    apply(data, 1, function(x) all(x==c(0,1,1)))

    This will go down each row of the frame and return TRUE for each row where the row is equal to c(0,1,1).

提交回复
热议问题