paste
Concatenate Data to Make Character Data

Description

Returns a vector of character strings (the result of pasting corresponding elements of the input vectors together). If the collapse argument is used, a single string is returned.

Usage

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

Arguments

... the input vectors to paste. Can be numeric, logical, complex, or character.

All arguments are coerced to mode character. Missing values (NAs) are allowed. If a name object is passed as an argument, it is coerced to a character vector of length one.

sep= the character string to be inserted between successive arguments. Can be "" for no space. The default is a single space.
collapse= a character string to use in collapsing the result. NULL by default, specifying no collapsing.

Details

The i-th element of the result is the concatenation of the i-th elements of the arguments. If the length of any argument is less than the maximum, elements of that argument are repeated cyclically. For example, an argument can be a single element, to appear in each element of the result.
If collapse is given, all strings produced are finally collapsed into one long string with the collapse string inserted between elements.
Value
returns a character vector with the length equal to the maximum of the lengths of the arguments (unless collapse is given, in which case the length is 1).
See Also
cat, character, deparse.
Examples
paste("no.",1:3)
# [1] "no. 1" "no. 2" "no. 3"

paste(1:3,4:6, sep="-") # [1] "1-4" "2-5" "3-6"

paste(1:10,collapse="") # [1] "12345678910"

paste(1:3,4:6, sep="-", collapse="; ") # [1] "1-4; 2-5; 3-6"

Package base version 4.0.0-28
Package Index