moveToFront: moveToFront

Description Usage Arguments Details Value Author(s) Examples

View source: R/ColumnReorder.r

Description

Rearranges column order by moving specified columns to the front or back.

Usage

1
2
3

Arguments

data

data.frame

cols

Character vector specifying the columns to be moved to the front or back

Details

Rearranges column order by moving specified columns to the front or back.

Value

A data.frame with the columns in the right order

Author(s)

Jared P. Lander

Examples

1
2
3
4
5
6
7
theDF <- data.frame(A=1:10, B=11:20, C=1:10, D=11:20)
moveToFront(theDF, c('B', 'C'))
moveToFront(theDF, c('C', 'B'))
moveToFront(theDF, c('C', 'C'))
moveToBack(theDF, c('C', 'C'))
moveToBack(theDF, c('C', 'B'))
moveToBack(theDF, c('C', 'C'))

useful documentation built on June 7, 2017, 9:02 a.m.