| any {base} | R Documentation |
Are Some Values True?
Description
Given a set of logical vectors, are any of the values true?
Usage
any(..., na.rm = FALSE)
Arguments
... |
one or more logical vectors. Other objects are coerced in
a similar way as |
na.rm |
logical. If true |
Details
This is a generic function: methods can be defined for it
directly or via the Summary group generic.
For this to work properly, the arguments ... should be
unnamed, and dispatch is on the first argument.
Value
Given a sequence of logical arguments, a logical value indicating
whether or not any of the elements of x are TRUE.
The value returned is TRUE if any of the values in x
are TRUE, and FALSE if all of the values in x
are FALSE.
If na.rm = FALSE and x consists of a mix of FALSE
and NA values, the value is NA.
References
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth \& Brooks/Cole.
See Also
all, the “complement” of any.
Examples
range(x <- sort(round(rnorm(10) - 1.2,1)))
if(any(x < 0)) cat("x contains negative values\n")