reorder.data.frame | R Documentation |
It can be tedious to reorder the columns in a data.frame. This function lets you move specific columns relative to some other named column.
## S3 method for class 'data.frame'
reorder(x, ..., who, after = NA)
x |
data.frame |
... |
ignored |
who |
a character vector of column names to move, or a logical vector of length names(x), or a vector of indices |
after |
the column after which to put who: may be character, integer, NA, or NULL |
data.frame: a variant of x
testData = expand.grid(start = 1,middle = LETTERS[1:3], end = c("K","L"))
reorder(testData, who = "start", after = "end")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.