Concatenate Data to Make Character Data

DESCRIPTION:

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

USAGE:

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

REQUIRED ARGUMENTS:

...
vectors or bdVectors that can be either numeric, logical, complex, or character. All arguments are coerced to mode character. Missing values ( NAs) are allowed.

OPTIONAL ARGUMENTS:

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

VALUE:

character vector or a bdCharacter, with length equal to the maximum of the lengths of the arguments (unless collapse is given, in which case the length is 1).

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. In particular, an argument can be a single element, to appear in each element of the result. If collapse is given, all of the strings produced are finally collapsed into one long string with the collapse string inserted between elements.

SEE ALSO:

, , , , , , .

EXAMPLES:

paste("no.",1:10)    # gives "no. 1", "no. 2" ... 
outer(month.name, 2001:2003, paste) # each month-year combination is produced 
paste(1:10,collapse="") # produces "12345678910" 
paste(state.name,"pop =", state.x77[,"Population"])   # "Alabama pop = 3615"... 
# The following shows  how to use levels of a factor in a call to paste.
> data.class(fuel.frame$Type)
[1] "factor"
> paste( "one", fuel.frame$Type[13:14], "auto" )
[1] "one 4 auto" "one 5 auto"
> paste( "one", as.character(fuel.frame$Type[13:14]), "auto" )
[1] "one Small auto"  "one Sporty auto"