Skip to content
Back to formatted view

Raw Message

Message-ID: <x2of3n6aeg.fsf@biostat.ku.dk>
Date: 2003-04-03T12:19:35Z
From: Peter Dalgaard
Subject: Combining the components of a character vector
In-Reply-To: <Pine.A41.4.44.0304021552520.19986-100000@mead5.u.washington.edu>

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