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 / ifelse < prev    next >
Encoding:
Text File  |  1997-04-23  |  486 b   |  18 lines

  1.     
  2.     _C_o_n_d_i_t_i_o_n_a_l _E_l_e_m_e_n_t _S_e_l_e_c_t_i_o_n
  3.     
  4.          ifelse(test, yes, no)
  5.     
  6.     _D_e_s_c_r_i_p_t_i_o_n:
  7.     
  8.          ifelse returns a value with the same shape as test
  9.          which is filled with elements selected from either yes
  10.          or no depending on whether the element of test is TRUE
  11.          or FALSE.  If yes or no are too short, their elements
  12.          are recycled.
  13.     
  14.     _E_x_a_m_p_l_e_s:
  15.     
  16.          x <- ifelse(x > 0, sqrt(x), 0)
  17.     
  18.