strtrim                 package:base                 R Documentation

_T_r_i_m _C_h_a_r_a_c_t_e_r _S_t_r_i_n_g_s _t_o _S_p_e_c_i_f_i_e_d _W_i_d_t_h_s

_D_e_s_c_r_i_p_t_i_o_n:

     Trim character strings to specified display widths.

_U_s_a_g_e:

     strtrim(x, width)

_A_r_g_u_m_e_n_t_s:

       x: a character vector, or an object which can be coerced to a
          character vector.

   width: Positive integer values: recycled to the length of 'x'.

_D_e_t_a_i_l_s:

     'Width' is interpreted as the display width in a monospaced font. 
     What happens with non-printable characters (such as backspace,
     tab) is implementation-dependent and may depend on the locale
     (e.g. they may be included in the count or they may be omitted).

     Using this function rather than 'substr' is important when there
     might be double-width characters in character vectors

_V_a_l_u_e:

     A character vector of the same length as 'x'.

_E_x_a_m_p_l_e_s:

     strtrim(c("abcdef", "abcdef", "abcdef"), c(1,5,10))

