I have a data frame which looks like the following
GR1-text GR11-text GR12-text GR2-text
A 1 1 0 0
B 1 0 1 1
I want to sort the dataframe to look like:
GR1-text GR2-text GR11-text GR12-test
A 1 0 1 0
B 1 1 0 1
I have tried the following which has not worked
test <- df[ , order(names(df))]
Ive also spotted this custom function but I cannot seen to get it to work.