[R] How to concatenate a several rows according with a column ?

tgodoy tingola_07 at hotmail.com
Fri Aug 3 19:00:24 CEST 2012


Hi, I'm a new user or R and I try to concatenate a several rows according
with the value in a column. 

this is my data.frame and I want to concatenate my data.frame according with
the column "b" and make a new data.frame with the information in the others
columns. 

>table1
         a                    b         c             d
1      E001234      TSA    IP234   like_domain
2      E001234      TSB    IP234   like_domain     
3      E001234      TSC    IP234   like_domain
4      E001234      TSD    IP234   like_domain
5      E001235      TSA    IP235   two_domain
6      E001235      TSD    IP235   two_domain
7      E001235      TSS    IP235   two_domain
8      E001236      TSP    IP236   like_domain
9      E001236      TST    IP236   like_domain
10    E001237      TSV    IP237   simple_domain

I want my table in this way

>table_new
         a                    b                                      c            
d
1      E001234      TSA, TSB, TSC, TSD    IP234   like_domain
2      E001235                TSA, TSD, TSS    IP235   two_domain
3      E001236                 TSP, TSP, TST    IP236   like_domain
4      E001237                                   TSV    IP237  
simple_domain

How can I do this in R? 

Thanks 




--
View this message in context: http://r.789695.n4.nabble.com/How-to-concatenate-a-several-rows-according-with-a-column-tp4639072.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list