I have a data in text file which contain several column, I would like to process data in such a way that I should not loose any information, some coulmn include two or more information seperated with special character such as "+" plus sign, I would like to put this combined information in differnt row within same column, for example I pasted data below here
My dataframe look like following
df <- data.frame(G1=c("GH13_22+CBM4", "GH109+PL7+GH9","GT57", "AA3","",""),
G2=c("GH13_22","","GT57+GH15","AA3", "GT41","PL+PL2"),
G3=c("GH13", "GH1O9","", "CBM34+GH13+CBM48", "GT41","GH16+CBM4+CBM54+CBM32"))
G1 G2 G3
1 GH13_22+CBM4 GH13_22 GH13
2 GH109+PL7+GH9 GH1O9
3 GT57 GT57+GH15
4 AA3 AA3 CBM34+GH13+CBM48
5 GT41 GT41
6 PL+PL2 GH16+CBM4+CBM54+CBM32
预期结果应如下所示
df2 <- data.frame(G1=c("GH13_22","CBM4", "GH109","PL7","GH9","GT57", "AA3","","","",""),
G2=c("GH13_22","","GT57","GH15","AA3", "GT41","PL","PL2","","",""),
G3=c("GH13", "GH1O9","", "CBM34","GH13","CBM48", "GT41","GH16","CBM4","CBM54","CBM32"))
G1 G2 G3
1 GH13_22 GH13_22 GH13
2 CBM4 GH1O9
3 GH109 GT57
4 PL7 GH15 CBM34
5 GH9 AA3 GH13
6 GT57 GT41 CBM48
7 AA3 PL GT41
8 PL2 GH16
9 CBM4
10 CBM54
11 CBM32
感谢您的任何帮助 谢谢