chartr                 package:base                 R Documentation

_C_h_a_r_a_c_t_e_r _T_r_a_n_s_l_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Translate characters in character vectors.

_U_s_a_g_e:

     chartr(old, new, x)
     tolower(x)
     toupper(x)

_A_r_g_u_m_e_n_t_s:

       x: a character vector.

     old: a character string specifying the characters to be
          translated.

     new: a character string specifying the translations.

_D_e_t_a_i_l_s:

     `chartr' translates each character in `x' that is specified in
     `old' to the corresponding character specified in `new'. Ranges
     are supported in the specifications, but character classes and
     repreated characters are not.  If `old' contains more characters
     than new, an error is signaled; if it contains fewer characters,
     the extra characters at the end of `new' are ignored.  

     `tolower' and `toupper' convert upper-case characters in a
     character vector to lower-case, or vice versa.  Non-alphabetic
     characters are left unchanged.

_E_x_a_m_p_l_e_s:

     x <- "MiXeD cAsE 123"
     chartr("iXs", "why", x)
     chartr("a-cX", "D-Fw", x)
     tolower(x)
     toupper(x)

