arrange_cols | R Documentation |
This wrapper function make use of the setcolorder() function and arrange columns by placing selected columns after the specified position.
arrange_cols(dt, at, ...)
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. |
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.