Learn R Programming

dplyr (version 0.5.0)

arrange: Arrange rows by variables.

Description

Use desc to sort a variable in descending order. Generally, this will not also automatically order by grouping variables.

Usage

arrange(.data, ...)

arrange_(.data, ..., .dots)

Arguments

.data

A tbl. All main verbs are S3 generics and provide methods for tbl_df, tbl_dt and tbl_sql.

...

Comma separated list of unquoted variable names. Use desc to sort a variable in descending order.

.dots

Used to work around non-standard evaluation. See vignette("nse") for details.

Value

An object of the same class as .data.

Data frame row names are silently dropped. To preserve, convert to an explicit variable.

Locales

Note that for local data frames, the ordering is done in C++ code which does not have access to the local specific ordering usually done in R. This means that strings are ordered as if in the C locale.

See Also

Other single.table.verbs: filter, mutate, select, slice, summarise

Examples

Run this code
arrange(mtcars, cyl, disp)
arrange(mtcars, desc(disp))

Run the code above in your browser using DataLab