powered by
Reorders the rows of one dataframe according to another vector (id vector)
reorder_df(df, col_sort, reorder_data)
Reordered dataframe
dataframe to reorder
column on which the rows will be reordered
vector with the new order
df <- data.frame(a = letters[1:3],b = LETTERS[4:6],c = 7:9) reorder_data<-c("c","a","b") df_new<-reorder_df(df,"a",reorder_data) df_new
Run the code above in your browser using DataLab