Arranges data frame variables by position

arrange.vars(data, vars)

Arguments

data

must be a data frame

vars

must be a named vector, e.g. c("var.name"=1)

Source

https://stackoverflow.com/questions/5620885/how-does-one-reorder-columns-in-a-data-frame

Value

OUTPUT_DESCRIPTION

Details

Credit goes to the user landroni on StackOverflow for this very useful function

Examples

arrange.vars(data, c("Out"=2, "Files"=1, "Time"=4))
#> Error in arrange.vars(data, c(Out = 2, Files = 1, Time = 4)): is.data.frame(data) is not TRUE