[R] Combining the components of a character vector
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Thu Apr 3 14:19:35 CEST 2003
John Miyamoto <jmiyamot at u.washington.edu> writes:
> 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" .
> paste(x) yields:
> paste(x)
> [1] "Bob" "loves" "Sally"
Like this:
> paste(x,collapse=" ")
[1] "Bob loves Sally"
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list