move_columns: Move columns in a dataframe

Description Usage Arguments Examples

View source: R/move_columns.R

Description

Re-arrange a dataframe by moving columns. You can use partial match to select the columns of interest (See get_col_indexes).

Usage

1
move_columns(x, columns, position)

Arguments

x

A dataframe.

columns

A vector containing column names. You can use partial matching and regular expressions.

position

Either a text or a number. Accepted values include "start" to move the columns in the begining of the dataframe, dataframe, "end" to move to the end or a number to specify the position that the columns will move (move after this number). See examples.

Examples

1
2
3
4
5
6
7
x <- data.frame(V1 = c("a", "b", "c"),
                V2 = c("A", "B", "C"),
                Z3 = c("c", "d", "e"))

 move_columns(x, "V1", 2)
 move_columns(x, "1$", 2)
 move_columns(x, "^Z", "start")

tkostas/komics documentation built on May 24, 2019, 7:31 a.m.