paste                  package:base                  R Documentation

_C_o_n_c_a_t_e_n_a_t_e _S_t_r_i_n_g_s

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

     Concatenate vectors after converting to character.

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

     paste(..., sep = " ", collapse = NULL)

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

     ...: one or more R objects, to be converted to character vectors.

     sep: a character string to separate the terms.  Not
          'NA_character_'.

collapse: an optional character string to separate the results.  Not
          'NA_character_'.

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

     'paste' converts its arguments (_via_ 'as.character') to character
     strings, and concatenates them (separating them by the string
     given by 'sep').  If the arguments are vectors, they are
     concatenated term-by-term to give a character vector result. 
     Vector arguments are recycled as needed, with zero-length
     arguments being recycled to '""'.

     Note that 'paste()' coerces 'NA_character_', the character missing
     value, to '"NA"' which may seem undesirable, e.g., when pasting
     two character vectors, or very desirable, e.g. in 'paste("the
     value of p is ", p)'.

     If a value is specified for 'collapse', the values in the result
     are then concatenated into a single string, with the elements
     being separated by the value of 'collapse'.

_V_a_l_u_e:

     A character vector of the concatenated values.  This will be of
     length zero if all the objects are, unless 'collapse' is non-NULL
     in which case it is a single empty string.

     If any input into an element of the result is in UTF-8, that
     element will be in UTF-8, otherwise in the current encoding in
     which case the encoding of an element of the element is declared
     if the current locale is either Latin-1 or UTF-8, at least one of
     the corresponding inputs (including separators) had a declared
     encoding and all inputs were either ASCII or declared.

_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:

     String manipulation with 'as.character', 'substr', 'nchar',
     'strsplit'; further, 'cat' which concatenates and writes to a
     file, and 'sprintf' for C like string construction.

     'plotmath' for the use of 'paste' in plot annotation.

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

     paste(1:12) # same as as.character(1:12)
     paste("A", 1:6, sep = "")
     paste("Today is", date())

