Check out example codes for "r - reorder columns in data frame". It will help you in understanding the concepts better.

Code Example 1

# Reorder by column name
df <- df[c("A", "B", "C")]

# Reorder by column index
df <- df[c(1, 3, 2)]

Learn ReactJs, React Native from akashmittal.com