[ top | up ]

Are Any Values True?

Syntax

any(x)

Value

Given a single logical argument, all returns a logical value indicating whether or not any of the elements of x are TRUE.

The value returned is TRUE if any the values in x are TRUE, and FALSE if all the values in x are FALSE. If x consists of a mix of FALSE and NA values, then any returns NA.

Examples

if(any(x < 0)) cat("x contains negative values\n")