I have a dataframe like this :
G2_ref G10_ref G12_ref G2_alt G10_alt G12_alt
20011953 3 6 0 5 1 5
12677336 0 0 0 1 3 6
20076754 0 3 0 12 16 8
2089670 0 4 0 1 11 9
9456633 0 2 0 3 10 0
468487 0 0 0 0 0 0
And I'm trying to sort the columns to have finally this column order :
G2_ref G2_alt G10_ref G10_alt G12_ref G12_alt
I tried : df[,order(colnames(df))]
But I had this order :
G10_alt G10_ref G12_alt G12_ref G2_alt G2_ref
If anyone had any idea it will be great.