any                   package:base                   R Documentation

_A_r_e _S_o_m_e _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, is at least one of the values
     true?

_U_s_a_g_e:

     any(..., 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 from R 2.7.0, as this was
     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 at least one of the values in 'x'
     is 'TRUE', and 'FALSE' if all of the values in 'x' are 'FALSE'
     (including if there are no values).  Otherwise the value is 'NA'
     (which can only occur if 'na.rm = FALSE' and '...' contains no
     'TRUE' 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'.

_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:

     'all', the 'complement' of 'any'.

_E_x_a_m_p_l_e_s:

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

