Concatenate vectors after converting to character.
paste (..., sep = " ", collapse = NULL) paste0(..., collapse = NULL)
- one or more R objects, to be converted to character vectors.
- a character string to separate the terms. Not
- an optional character string to separate the results. Not
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
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).
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 (and none are declared with encoding
"bytes"), that element will be in UTF-8, otherwise in the current encoding in which case the encoding 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.
If an input into an element is declared with encoding
"bytes", no translation will be done of any of the elements and the resulting element will have encoding
collapse is non-NULL, this applies also to the second, collapsing, phase, but some translation may have been done in pasting object together in the first phase.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
‘plotmath’ for the use of
paste in plot annotation.
Documentation reproduced from R 3.0.2. License: GPL-2.