[R] or of a logical vector

Gabor Grothendieck ggrothendieck at myway.com
Thu Aug 5 20:19:51 CEST 2004


Ben Wittner <bwittner <at> jimmy.harvard.edu> writes:

: Is there some fast (built-in?) way to get the OR of all the elements in a
: logical vector?

Here are two possibilities:

max(x) == 1
sum(x) > 0

These use the fact that logicals used in arithmetic operations
are converted such that TRUE becomes 1 and FALSE becomes 0.




More information about the R-help mailing list