all                   package:base                   R Documentation

Are All Values True?

Description:

     Given a set of logical vectors, are all of the values true?

Usage:

     all(..., na.rm = FALSE)

Arguments:

     ...: one or more logical vectors.

   na.rm: logical. If true 'NA' values are removed before the result is
          computed.

Details:

     This is a generic function: methods can be defined for it directly
     or via the 'Summary' group generic.

Value:

     Given a sequence of logical arguments, a logical value indicating
     whether or not all of the elements of 'x' are 'TRUE'.

     The value returned is 'TRUE' if all the values in 'x' are 'TRUE',
     and 'FALSE' if any the values in 'x' are 'FALSE'.

     If 'x' consists of a mix of 'TRUE' and 'NA' values, then value is
     'NA'.

References:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

See Also:

     'any', the "complement" of 'all', and 'stopifnot(*)' which is an
     'all(*)' "insurance".

Examples:

     range(x <- sort(round(rnorm(10) - 1.2,1)))
     if(all(x < 0)) cat("all x values are negative\n")

