Re: [R] Very simple question

From: Jim Lemon <jim_at_bitwrit.com.au>
Date: Fri, 08 Apr 2011 21:49:03 +1000

On 04/08/2011 08:44 PM, Ronaldo Reis Junior wrote:
> Hi,
>
> I have a very simple doubt.
>
> Look:
>
> > teste <- c("A","B","C")
>
> > teste2 <- paste(teste[1],teste[2],teste[3],sep="+")
> > teste2
> [1] "A+B+C"

> >
>
> How to make it automatic, like I try to use paste(teste,sep="+") but the
> paste dont get the teste elements separately to join again in a unique
> element.
>
> Exist any function to associated with paste make this result more
> automatically.
>
Hi Ronaldo,

Try:

paste(teste,collapse="+")

Jim



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. Received on Fri 08 Apr 2011 - 10:52:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 08 Apr 2011 - 11:00:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive