laterstat - 2 months ago 7x

R Question

I would like to use the Boolean R operator OR on rows of matrices. Below you find my solution to a simple toy example using the apply function. What is the easiest/fastest way of doing this? How does this generalize to other Boolean operations?

`b <- matrix(c(T,T,F,T,F,F),3)`

apply(b,1, function(x) T %in% x)

Answer

Source (Stackoverflow)

Comments