[ top | up ]

Are All Values True?

Syntax

all(x)

Value

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

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

Examples

if(all(x>0)) cat("All x values are positive\n")