Saturday, 31 August 2013

R: return one TRUE / FALSE from a group of boolean values

R: return one TRUE / FALSE from a group of boolean values

Suppose:
mu.iter <- c(3,3,3,3)
mu <- c(1,4,1,4)
> abs(mu.iter - mu) > 1.5
[1] TRUE FALSE TRUE FALSE
Instead of four TRUE/FALSE values, I just want one TRUE / FALSE value,
such that it only returns TRUE when all 4 are TRUE and FALSE otherwise.
The reason is that I want to put this into a while-loop.

No comments:

Post a Comment