I would like to make a new matrix from another matrix but only with rows which do not contain 0, how can I do that?
Here is a more vectorized way.
x <- matrix(c(0,0,0,1,1,0,1,1,1,1), ncol = 2, byrow = TRUE)
x[rowSums(x==0)==0,]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With