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 / pmatch < prev    next >
Encoding:
Text File  |  1997-04-23  |  985 b   |  35 lines

  1.     
  2.     _P_a_r_t_i_a_l _S_t_r_i_n_g _M_a_t_c_h_i_n_g
  3.     
  4.          pmatch(x, table, nomatch = NA)
  5.          charmatch(x, table, nomatch = NA)
  6.     
  7.     _A_r_g_u_m_e_n_t_s:
  8.     
  9.                x : the values to be matched.
  10.     
  11.            table : the values to be matched against.
  12.     
  13.          nomatch : the value returned at non-matching positions.
  14.     
  15.     _D_e_s_c_r_i_p_t_i_o_n:
  16.     
  17.          pmatch seeks matches for the elements of its first
  18.          argument among those of its second.  If there is a
  19.          unique match then the index of the matching value is
  20.          returned; if multiple matches are found then 0 is
  21.          returned and if no match is found then NA is returned.
  22.     
  23.          This function is based on Terry Therneau's charmatch S
  24.          function.  In R, charmatch is synonym to pmatch.
  25.     
  26.     _S_e_e _A_l_s_o:
  27.     
  28.          match.
  29.     
  30.     _E_x_a_m_p_l_e_s:
  31.     
  32.          pmatch("m",   c("mean", "median", "mode")) # returns 0
  33.          pmatch("med", c("mean", "median", "mode")) # returns 2
  34.     
  35.