[R] Thanks re Combining the components of a character vector

John Miyamoto jmiyamot at u.washington.edu
Thu Apr 3 21:25:06 CEST 2003

Many people pointed out that the 'collapse' argument yields the solution
to my query:

> x <- c("Bob", "loves", "Sally")
> paste(x, collapse=" ")
[1] "Bob loves Sally"

I had looked at the documentation for 'paste' within R and also in several
books before sending my question to R-Help, so I was aware of the
'collapse' argument, but I was making the mistake of abbreviating

> paste(x, col=" ")
[1] "Bob  "   "loves  " "Sally  "

The real source of my confusion was that I wasn't aware that arguments
following '...' must be fully specified.  Now I know that this is
important.  Thanks for the help.


John Miyamoto, Dept. of Psychology, Box 351525
University of Washington, Seattle, WA 98195-1525
Phone 206-543-0805, Fax 206-685-3157, Email jmiyamot at u.washington.edu
Homepage http://faculty.washington.edu/jmiyamot/

More information about the R-help mailing list