[R] Combining the components of a character vector

Jean-Pierre.Mueller@dssp.unil.ch Jean-Pierre.Mueller at dssp.unil.ch
Thu Apr 3 17:30:28 CEST 2003


At 15:54 -0800 2.4.2003, John Miyamoto wrote:
>Dear Help,
>   Suppose I have a character vector.
>
>x <- c("Bob", "loves", "Sally")
>
>I want to combine it into a single string:  "Bob loves Sally" .
>[...]
>Is there a more natural (no loop) way to do this in R?
>
>John Miyamoto


paste(x, sep = "", collapse = " ") ?


------------------------------------------------------------------------------
Jean-Pierre Muller
SSP / UNIL /  BFSH2 / CH-1015 Lausanne



More information about the R-help mailing list