reorder.data.frame: Reorder names in a data.frame

reorder.data.frameR Documentation

Reorder names in a data.frame

Description

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.

Usage

## S3 method for class 'data.frame'
reorder(x, ..., who, after = NA)

Arguments

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

Value

data.frame: a variant of x

Examples

testData = expand.grid(start = 1,middle = LETTERS[1:3], end = c("K","L"))
reorder(testData, who = "start", after = "end")

qPharmetra/qpToolkit documentation built on May 24, 2023, 8:52 a.m.