char.expand               package:base               R Documentation

_E_x_p_a_n_d _a _S_t_r_i_n_g _w_i_t_h _R_e_s_p_e_c_t _t_o _a _T_a_r_g_e_t _T_a_b_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     Seeks a unique match of its first argument among the elements of
     its second.  If successful, it returns this element; otherwise, it
     performs an action specified by the third argument.

_U_s_a_g_e:

     char.expand(input, target, nomatch = stop("no match"))

_A_r_g_u_m_e_n_t_s:

   input: a character string to be expanded.

  target: a character vector with the values to be matched against.

 nomatch: an R expression to be evaluated in case expansion was not
          possible.

_D_e_t_a_i_l_s:

     This function is particularly useful when abbreviations are
     allowed in function arguments, and need to be uniquely expanded
     with respect to a target table of possible values.

_S_e_e _A_l_s_o:

     'charmatch' and 'pmatch' for performing partial string matching.

_E_x_a_m_p_l_e_s:

     locPars <- c("mean", "median", "mode")
     char.expand("me", locPars, warning("Could not expand!"))
     char.expand("mo", locPars)

