Learn R Programming

plyr (version 1.5.2)

arrange: Order a data frame by its colums.

Description

Order a data frame by its colums.

Usage

arrange(df, ...)

Arguments

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

Details

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!

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