Learn R Programming

plyr (version 1.6)

arrange: Order a data frame by its colums.

Description

This function completes the subsetting, transforming and ordering triad with a function that works in a similar way to subset and transform but for reordering a data frame by its columns. This saves a lot of typing!

Usage

arrange(df, ...)

Arguments

df
data frame to reorder
...
expressions evaluated in the context of df and then fed to order

Examples

Run this code
mtcars[with(mtcars, order(cyl, disp)), ]
arrange(mtcars, cyl, disp)
arrange(mtcars, cyl, desc(disp))

Run the code above in your browser using DataLab