Example data frame:
test <- data.frame(A=c(0,1,2), B=c(0,2,3), C=c(0,1,0))
test
A B C
1 0 0 0
2 1 2 1
3 2 3 0
What I am trying to get:
A B C
2 1 2 1
When a row contains ≥1 cell equals to 0, discard it.
I am aware of the following, but I am looking for a more general solution, in the case I don't know how many columns my data frame is made of.
test[which(test$A !=0 & test$B !=0 & test$C != 0),]