[R] Combining the components of a character vector

Douglas Bates bates at stat.wisc.edu
Thu Apr 3 15:59:03 CEST 2003

Use the collapse argument to paste.

> paste(c('Bob', 'loves', 'Sally'), collapse = ' ')
[1] "Bob loves Sally"

John Miyamoto <jmiyamot at u.washington.edu> writes:

>    Suppose I have a character vector.
> x <- c("Bob", "loves", "Sally")
> I want to combine it into a single string:  "Bob loves Sally" .

More information about the R-help mailing list