[R] Help for string opeation

arun smartpink111 at yahoo.com
Fri Jun 29 14:44:28 CEST 2012


Hi,

You could use "do.call" :
 a1<-c("A","B","C")
 a2<-c("D","E")
 a3<-"F"

 mylist<-list(a1,a2,a3)


 do.call("c",mylist)
[1] "A" "B" "C" "D" "E" "F"

A.K.



----- Original Message -----
From: Pascal Oettli <kridox at ymail.com>
To: Takatsugu Kobayashi <taquito2007 at gmail.com>
Cc: R-help at r-project.org
Sent: Friday, June 29, 2012 3:16 AM
Subject: Re: [R] Help for string opeation

Hello,

Does 'unlist' function do what you are asking about?

Regards.


Le 29/06/2012 11:52, Takatsugu Kobayashi a écrit :
> Hi R users,
>
> I appreciate if you could give me some hint/help on this string operation.
>
> Suppose I have a list of string objects in varying sizes like
>
> [[1]]
> [1] "A" [2] "B" [3] "C"
>
> [[2]]
> [1] "D" [2] "E"
>
> [[3]]
> [1] "F"
>
> Then I would like to create a vector that contains all elements like
>
> [1] "A" "B" "C" "D" "E" "F"
>
> I tried do.call + rbind but no luck yet.
>
> Is there a function to do this operation or should I use append in the loop?
>
> Thanks in advance!
>
> Taka
>
>     [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>

______________________________________________
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.




More information about the R-help mailing list