[R] preventing repeat in "paste"

Dimitri Liakhovitski dimitri.liakhovitski at gmail.com
Sat Feb 26 20:41:44 CET 2011


This is great, thanks a lot, Gabor!

On Fri, Feb 25, 2011 at 6:18 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> 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
>



-- 
Dimitri Liakhovitski
Ninah Consulting
www.ninah.com



More information about the R-help mailing list