character                package:base                R Documentation

_C_h_a_r_a_c_t_e_r _V_e_c_t_o_r_s

_D_e_s_c_r_i_p_t_i_o_n:

     Create or test for objects of type '"character"'.

_U_s_a_g_e:

     character(length = 0)
     as.character(x, ...)
     is.character(x)

_A_r_g_u_m_e_n_t_s:

  length: desired length.

       x: object to be coerced or tested.

     ...: further arguments passed to or from other methods.

_D_e_t_a_i_l_s:

     'as.character' and 'is.character' are generic: you can write
     methods to handle specific classes of objects, see
     InternalMethods.

_V_a_l_u_e:

     'character' creates a character vector of the specified length.
     The elements of the vector are all equal to '""'.

     'as.character' attempts to coerce its argument to character type;
     like 'as.vector' it strips attributes including names.

     'is.character' returns 'TRUE' or 'FALSE' depending on whether its
     argument is of character type or not.

_N_o_t_e:

     'as.character' truncates components of language objects to 500
     characters (was about 70 before 1.3.1).

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     'paste', 'substr' and 'strsplit' for character concatenation and
     splitting, 'chartr' for character translation and casefolding
     (e.g., upper to lower case) and 'sub', 'grep' etc for string
     matching and substitutions.  Note that 'help.search(keyword =
     "character")' gives even more links. 'deparse', which is normally
     preferable to 'as.character' for language objects.

_E_x_a_m_p_l_e_s:

     form <- y ~ a + b + c
     as.character(form)  ## length 3
     deparse(form)       ## like the input

