[ top | up ]

Are Any Values True?

Syntax

any(x)

Description

any takes a single logical argument x and 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")