home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Educational / R-0.49-MI / R-0.49-I / help / base / all < prev    next >
Encoding:
Text File  |  1997-04-23  |  978 b   |  29 lines

  1.     
  2.     _A_r_e _A_l_l / _A_n_y _V_a_l_u_e_s _T_r_u_e?
  3.     
  4.          all(x)
  5.          any(x)
  6.     
  7.     _V_a_l_u_e:
  8.     
  9.          Given a single logical argument, all returns a logical
  10.          value indicating whether or not all of the elements of
  11.          x are TRUE.  The value returned is TRUE if all the
  12.          values in x are TRUE, and FALSE if any the values in x
  13.          are FALSE.  If x consists of a mix of TRUE and NA
  14.          values, then all returns NA.
  15.     
  16.          Given a single logical argument, any returns a logical
  17.          value indicating whether or not any of the elements of
  18.          x are TRUE.  The value returned is TRUE if any the
  19.          values in x are TRUE, and FALSE if all the values in x
  20.          are FALSE.  If x consists of a mix of FALSE and NA
  21.          values, then any returns NA.
  22.     
  23.     _E_x_a_m_p_l_e_s:
  24.     
  25.          range(x <- sort(round(rnorm(10) - 1.2,1)))
  26.          if(any(x < 0)) cat("x contains negative values\n")
  27.          if(all(x < 0)) cat("all x values are negative\n")
  28.     
  29.