0

I have many columns of data that all have values of either 0, 1, or NA. For one table, I'm trying to get observations with at least one 1 in any column, so I'm using something like

subset(mydata, x == 1 | y == 1 | z == 1) 

which works fine. For the second table, I'm trying to get observations with no 1 in any column, so I'm using something like

subset(mydata, x != 1 & y != 1 & z != 1)

which returns 0 observations. Considering that I have 200,000 observations total, and the first table contains ~70,000, it only makes sense to me that its inverse contains ~130,000, but this is not the case. Does anyone know what I can do here?

Miha
  • 2,559
  • 2
  • 19
  • 34
mistersunnyd
  • 211
  • 3
  • 10
  • I've also tried subset(mydata,!(x==1 | y==1 | z==1)), and the result is still nothing. – mistersunnyd Jul 09 '18 at 19:26
  • 1
    When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Jul 09 '18 at 19:33

0 Answers0