arrange_cols: Arrange columns

View source: R/arrange_cols.R

arrange_colsR Documentation

Arrange columns

Description

This wrapper function make use of the setcolorder() function and arrange columns by placing selected columns after the specified position.

Usage

arrange_cols(dt, at, ...)

Arguments

dt

input data.table

at

position for inserting the selected columns. This can be any valid column names, which will place the selected columns after the "at" column. Alternatively use "start" or "end" for placing the selected columns before the first column or after the last column respectively

...

a vector of characters of column names or valid column names seperated by commas.

Examples

## Not run: 
dt <- data1 |> dt_keeprownames() |> rn_cols(rn=`vehicle model`)
arrange_cols(dt, at=`vehicle model`, qsec, vs, am)
arrange_cols(dt, at="start", c("qsec", "vs", "am"))
arrange_cols(dt, at="mpg", qsec:am, carb)

## End(Not run)

kleu046/wr.data.table documentation built on April 25, 2022, 1:41 p.m.