Reorder the columns of a data frame.

move_columns_to_front(df, columns)

Arguments

df

The data frame that shall be reordered.

columns

One or multiple column names that should be moved to the front of the dataframe. Order is kept.

Value

Data frame with reordered columns.

Details

Sets the desired columns of the dataframe df to the first columns. Does not change the order of the others.

Examples

## move_columns_to_fron(df, c("new_first_column", "new_second_column"))