colorder | R Documentation |
Set data table columns to a specified order
colorder(df, col_order)
df |
a data table to be ordered |
col_order |
a character vector of column names in the desired order. |
This function modifies by reference. If a column that is not present is supplied
to col_order
, it will simply skip over it without error.
a data table
x <- data.table::data.table(c = c(1,2,3), b = c(1,2,3), a = c(1,2,3))
col_order <- c("a","b","c")
nsqipr:::colorder(x, col_order)
identical(names(x), col_order)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.