[R] preventing repeat in "paste"
Ista Zahn
izahn at psych.rochester.edu
Fri Feb 25 23:42:05 CET 2011
Hi Dimitri,
You can do it like this:
paste(s,paste(middle, collapse=""),e,sep=" ")
Best,
Ista
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=" ")
>
>
> Thank you!
> --
> Dimitri Liakhovitski
> Ninah Consulting
> www.ninah.com
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org
More information about the R-help
mailing list