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 / substr < prev    next >
Encoding:
Text File  |  1997-04-23  |  903 b   |  30 lines

  1.     
  2.     _E_x_t_r_a_c_t _S_u_b_s_t_r_i_n_g_s _f_r_o_m _a _C_h_a_r_a_c_t_e_r _V_e_c_t_o_r
  3.     
  4.          substr(x, start, stop)
  5.          substring(text, first, last = 1000000)
  6.     
  7.     _D_e_s_c_r_i_p_t_i_o_n:
  8.     
  9.          substr takes a character vector as an argument and
  10.          returns a vector whose elements contain the substring
  11.          starting with the character at position start up to the
  12.          character at position stop. If start is larger than the
  13.          string length then NA is returned. If stop is longer
  14.          than start and error is signalled.
  15.     
  16.          substring is compatible with S. For vector arguments,
  17.          it expands the arguments cyclically.
  18.     
  19.     _S_e_e _A_l_s_o:
  20.     
  21.          paste, nchar, strsplit
  22.     
  23.     _E_x_a_m_p_l_e_s:
  24.     
  25.          x <- c("asfef","qwerty","yuiop[","b","stuff.blah.yech")
  26.          substr(x,3,5)
  27.          substring(x,3,5)
  28.          substring(x,3,3:5)
  29.     
  30.