[R] preventing repeat in "paste"
Gabor Grothendieck
ggrothendieck at gmail.com
Sat Feb 26 00:18:21 CET 2011
On Fri, Feb 25, 2011 at 5:21 PM, Dimitri Liakhovitski
<dimitri.liakhovitski at gmail.com> wrote:
> Hello!
>
> s<-"start"; e<-"end"
> middle<-as.character(c(1,2,3))
>
> I would like to get the following result:
> "start 123 end" or "start 1 2 3 end" or "start 1,2,3 end"
>
> How can I avoide this (undesired) result:
> paste(s,middle,e,sep=" ")
Try this:
> paste(s, toString(middle), e)
[1] "start 1, 2, 3 end"
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-help
mailing list