I have a data.frame that looks like:
Input_SNP Set_1 Set_2 Set_3
4:184648954 18:71883827 7:135798891 7:91206783
13:34371442 14:52254555 1:223293324 7:54912662
18:71883393 22:50428069 7:138698825 8:97486210
I would like to extra the number before the colon and make it a new column called CHR for each of these columns. I would like to extract the number after the colon and make it a new column called BP. To make this clearer, this is what desired output would be:
Input_SNP_CHR Input_SNP_BP Set_1_CHR Set_1_BP Set_2_CHR Set_2_BP Set_3_CHR Set_3_BP
4 184648954 18 71883827 7 135798891 7 91206783
13 34371442 14 52254555 1 223293324 7 54912662
18 71883393 22 50428069 7 138698825 8 97486210
Thus, I would like to start with N columns and finish with 2N columns. How can I do this? Should I use grep?