Re: [R] splitting a string column into multiple columns faster

2013-06-08 Thread arun
ccc8_ccc1_fff11  8  1 11 #3: hhh15_ggg2_hhh13 15  2 13 #4:   fff9_bbb3_ccc9  9  3  9 #5:  ggg4_eee2_jjj14  4  2 14 #6:  jjj7_ddd9_bbb15  7  9 15 A.K. ________ From: Dimitri Liakhovitski To: arun Cc: R help Sent: Saturday, June 8, 2013 5:59 PM Subject: Re: [R] splitting a string colu

Re: [R] splitting a string column into multiple columns faster

2013-06-08 Thread Dimitri Liakhovitski
g2_jjj14 12 2 14 >> #2 ccc7_ddd15_aaa11 7 15 11 >> #3 hhh12_ddd14_fff12 12 14 12 >> #4 fff11_bbb15_aaa6 11 15 6 >> #5 ggg12_ccc9_ggg8 12 9 8 >> #6 jjj8_eee12_eee4 8 12 4 >> >> A.K. >> >> >> - Original Message - >> From: arun >&g

Re: [R] splitting a string column into multiple columns faster

2013-06-08 Thread Dimitri Liakhovitski
jjj14 12 2 14 > #2 ccc7_ddd15_aaa11 7 15 11 > #3 hhh12_ddd14_fff12 12 14 12 > #4 fff11_bbb15_aaa6 11 15 6 > #5 ggg12_ccc9_ggg8 12 9 8 > #6 jjj8_eee12_eee4 8 12 4 > > A.K. > > > - Original Message - > From: arun > To: Dimitri Liakhovitski > Cc: R he

Re: [R] splitting a string column into multiple columns faster

2013-06-07 Thread arun
arun To: Dimitri Liakhovitski Cc: R help Sent: Friday, June 7, 2013 11:00 PM Subject: Re: [R] splitting a string column into multiple columns faster HI, May be this helps: res<-data.frame(x=x,read.table(text=gsub("[A-Za-z]","",x[,1]),sep="_",header=FALSE),strings

Re: [R] splitting a string column into multiple columns faster

2013-06-07 Thread arun
ginal Message - From: Dimitri Liakhovitski To: r-help Cc: Sent: Friday, June 7, 2013 9:24 PM Subject: [R] splitting a string column into multiple columns faster Hello! I have a column in my data frame that I have to split: I have to distill the numbers from the text. Below is my example an

[R] splitting a string column into multiple columns faster

2013-06-07 Thread Dimitri Liakhovitski
Hello! I have a column in my data frame that I have to split: I have to distill the numbers from the text. Below is my example and my solution. x<-data.frame(x=c("aaa1_bbb1_ccc3","aaa2_bbb3_ccc2","aaa3_bbb2_ccc1")) x library(stringr) out<-as.data.frame(str_split_fixed(x$x,"aaa",2)) out2<-as.data.