I have a dataframe in R. I'm ordering the columns alphabetically like this:
df_ordered <- df[,order(names(df))]
Now I want to select a specific column by name (column name is "city") and "pull" it to the front while leaving the rest unchanged, i.e. if the columns are:
alpha, beta, city, delta
I want them to be
city, alpha, beta, delta
Thanks for your help.