Displaying 2 results from an estimated 2 matches for "_bbb".
Did you mean:
8bbb
2013 Jun 08
1
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 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.frame(str_split_fixed(out$V2,"_bbb",2))
out3<-as.data.frame(str_split_fixed(out2$V2,"_ccc",2))
result<-cbin...
2012 Feb 16
2
creating series of vectors
...ays of the single months (considering a non-leap-year, 356 days)
multiplied by 2 (e.g. "January2006" will have 31*2=62 elements,
"February2006" will have 28*2=56 elements, and so on).
Finally, the elements of the vectors should be named as:
"010106_aaa","010106_bbb","020106_aaa","020106_bbb", ... ,
"310106_aaa","310106_bbb".
To sum up, at the end of the process i would like to obtain 12 vectors
as it follows:
Jauary2006("010106_aaa","010106_bbb","020106_aaa","020106_bbb",...