all                   package:base                   R Documentation

_A_r_e _A_l_l _V_a_l_u_e_s _T_r_u_e?

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

     ...: zero or more logical vectors.  Other objects of zero length
          are ignored, and the rest are coerced to logical ignoring any
          class.

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

_D_e_t_a_i_l_s:

     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.

     Coercion of types other than integer (raw, double, complex,
     character, list) gives a warning as this is often unintentional.

_V_a_l_u_e:

     The value is a logical vector of length one.

     Let 'x' denote the concatenation of all the logical vectors in
     '...' (after coercion), after removing 'NA's if requested by
     'na.rm = TRUE'.

     The value returned is 'TRUE' if all of the values in 'x' are
     'TRUE' (including if there are no values), and 'FALSE' if at least
     one of the values in 'x' is 'FALSE'.  Otherwise the value is 'NA'
     (which can only occur if 'na.rm = FALSE' and '...' contains no
     'FALSE' values and at least one 'NA' value).

_S_4 _m_e_t_h_o_d_s:

     This is part of the S4 'Summary' group generic.  Methods for it
     must use the signature 'x, ..., na.rm'.

_N_o_t_e:

     That 'all(logical(0))' is true is a useful convention: it ensures
     that


       all(all(x), all(y)) == all(x,y)

     even if 'x' has length zero.

_R_e_f_e_r_e_n_c_e_s:

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

_S_e_e _A_l_s_o:

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

_E_x_a_m_p_l_e_s:

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

     all(logical(0))  # true, as all zero of the elements are true.

