colsToFront {useful} | R Documentation |
Moves column names to the front or back of the names
colsToFront(data, cols = names(data))
colsToBack(data, cols = names(data))
data |
data.frame or tbl |
cols |
Columns that should be moved |
Moves column names to the front or back of the names
Character vector of column names
Jared P. Lander
theDF <- data.frame(A=1:10, B=11:20, C=1:10, D=11:20)
colsToFront(theDF, c('B', 'C'))
colsToFront(theDF, c('C', 'B'))
colsToFront(theDF, c('C', 'C'))
colsToBack(theDF, c('C', 'C'))
colsToBack(theDF, c('C', 'B'))
colsToBack(theDF, c('C', 'C'))