I need an additional solution to the previous question/answer Move characters from beginning of column name to end of column name
I have a dataset where column names have two parts divided by _ e.g.
pal036a_lon
pal036a_lat
pal036a_elevation
I would like to convert the prefixes into suffixes so that it becomes:
lon_pal036a
lat_pal036a
elevation_pal036a
The answer to the previous question
names(df) <- sub("([a-z])_([a-z]+)", "\\2_\\1", names(df))
does not work for numbers within the prefixes.