powered by
Reorder the columns of a data frame
df_reorder(df, columns, after)
The reordered data frame
the data frame
the column(s) to move (either as character names or numeric indices)
the column after which to insert columns (must be a scalar, either a character name or a numeric index)
columns
df <- data.frame(a = 1:10, b = 11:20, c = 21:30, d = 31:40) df_reorder(df, 2:3, "d") df_reorder(df, c("c", "d"), "a")
Run the code above in your browser using DataLab