fairly novice in data.table so I must be missing something obvious.
DT <- data.table(a=1:4,b=c(0,1,2,3),c=c(0,2,0,3),d=c(0,3,2,1),e=c(0,8,5,3))
a b c d e
1: 1 0 0 0 0
2: 2 1 2 3 8
3: 3 2 0 2 5
4: 4 3 3 1 3
I want to select the rows where columns b,c,d and e are ==0 without assuming I know the column names before hand. So using a colNames <- c('b','c','d','e') vector for it.
I tried
DT[all(DT[,colNames]==0)]
to no avail obviously.
Any pointers welcome !