View source: R/ColumnReorder.r
moveToFront | R Documentation |
Rearranges column order by moving specified columns to the front or back.
moveToFront(data, cols)
moveToBack(data, cols)
data |
data.frame |
cols |
Character vector specifying the columns to be moved to the front or back |
Rearranges column order by moving specified columns to the front or back.
A data.frame with the columns in the right order
Jared P. Lander
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'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.