[R] or of a logical vector

Thomas Lumley tlumley at u.washington.edu
Thu Aug 5 23:08:20 CEST 2004

On Thu, 5 Aug 2004, Liaw, Andy wrote:

> Is there anything wrong with sum(v) > 0?

any(v) has the advantage of having the same NA handling as Ben's function,
so that any(v) is TRUE if there is at least one TRUE and any number of NAs
and is NA if there are NAs and no TRUEs.


More information about the R-help mailing list