Hi, Suppose I have a logical vector x, I want to compute the 'and' and 'or' of all its element (the result should be a single value TRUE or FALSE). I have read the R-intro.pdf logical vector section, but I don't find the answer. Can somebody let me know how to do it?>x= rep(TRUE, 3)Regards, Peng
David Winsemius
2009-Sep-05 02:43 UTC
[R] How to or or and all the values in a logical vector?
On Sep 4, 2009, at 10:37 PM, Peng Yu wrote:> Hi, > > Suppose I have a logical vector x, I want to compute the 'and'?all> and > 'or'?any> of all its element (the result should be a single value TRUE or > FALSE). I have read the R-intro.pdf logical vector section, but I > don't find the answer.I couldn't find them either.> Can somebody let me know how to do it? > >> x= rep(TRUE, 3) > > Regards, > Peng-- David Winsemius, MD Heritage Laboratories West Hartford, CT